Bug #5630
closed
VmWare clone from template fails if Network Adator has labels in VmWare
Added by Jean-Christophe Counio over 10 years ago.
Updated over 6 years ago.
Category:
Compute resources - VMware
|
Description
In VmWare you can define labels for Network Adapters, and that's the list that is returned in the 'New Host' form 'Network interfaces' list.
In app/models/compute_resources/foreman/model/vmware.rb, in clone_vm, the network adapter is hardcoded as "Network adapter 1":
interface = interfaces.detect{|i| i[:name] == "Network adapter 1" }
Since it is not in the interfaces list, clone is failing with error :
Failed to save: Failed to create a compute [...] instance [...]: undefined method `[]' for nil:NilClass
/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:292:in `clone_vm'
/usr/share/foreman/app/models/compute_resources/foreman/model/vmware.rb:257:in `create_vm'
Solution would be to use the selected interface from args instead of having it hardcoded
- Related to Bug #5483: Network label empty after cloning vware vm using image and distributed switch for network added
- Category set to Compute resources
Our vSphere was once upon a time (ESX3.x) installed in German and the expression for the "Network adapter 1" is then "Netzwerkadapter 1". I am not suggesting to support all locales at this point but i second Jean-Christophe that this should not be hard coded.
Cheers Jan
Here is another one for hardcoding. For some reason our vSphere has been installed with some german fragments. This is why all of the deployment features from within foreman did not work:
foreman/app/models/compute_resources/foreman/model/vmware.rb:309
path_replace = %r{/Datacenters/#{datacenter}/vm(/|)}
in german this rather is:
path_replace = %r(/Datencenter/#{datacenter}/vm(/|))
Again, so suggestion to support locales, but hardcoding seems to be causing trouble.
Thanks for all the work!
Cheers Jan
- Category changed from Compute resources to Compute resources - VMware
For people experiencing the same issue, this is a (very temporary) fix that seems to work just fine with Foreman 1.6.1: https://gist.github.com/azet/d55045995d0ef49497c5
A generic solution for the issue would be appreciated - but I understand that not many deployments will have this issue.
We ran into this issue while trying to setup Foreman against our Vsphere 5.5U1 environment. From what I could tell there was no localization issues since this install was EN based.
The template we were trying to deploy from was copied over from another data-center(within vcenter).
When we copied the template over it was edited to reference the correct VDS for the new datacenter/network/hyp's it will be servicing. However with all that said, we still had this issue. When looking at the template when converted to a VM, it showed a single network adapter, but that adapter was #2 in the list.
What resolve the problem for us was to delete that network adapter, save(click ok), re-add a network adapter and select a default VDS/port-group. Now the adapter displays as "adapter #1" , instead of "adapter #2" and we are able to deploy VM's.
Cheers.
Edit: This was with Foreman 1.6.1
- Related to Bug #7740: Installing from VMware Image breaks distributed Port Group support added
- Has duplicate Support #9956: Failed to create a compute <Datacenter> (VMWare) instance foo.sub.domain.tld: undefined method `[]' for nil:NilClass added
- Related to Bug #9704: Network label is unchanged on additional network interfaces with VMware templates added
#9704 (which won't be merged for a while) will fix the Network Adapter name lookup, but the Datacenter name.
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2549 added
- Pull request deleted (
)
- Translation missing: en.field_release set to 35
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Related to Bug #14874: Path incorrect when using vm_clone method added
Also available in: Atom
PDF