Bug #5630
closedVmWare clone from template fails if Network Adator has labels in 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
Updated by Dominic Cleal over 10 years ago
- Related to Bug #5483: Network label empty after cloning vware vm using image and distributed switch for network added
Updated by Jan Behrend over 10 years ago
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
Updated by Jan Behrend over 10 years ago
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
Updated by Dominic Cleal over 10 years ago
- Category changed from Compute resources to Compute resources - VMware
Updated by Aaron Zauner about 10 years ago
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.
Updated by Friedrich Seifts about 10 years ago
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.
Updated by Friedrich Seifts about 10 years ago
Edit: This was with Foreman 1.6.1
Updated by Friedrich Seifts about 10 years ago
- Related to Bug #7740: Installing from VMware Image breaks distributed Port Group support added
Updated by Dominic Cleal over 9 years ago
- Has duplicate Support #9956: Failed to create a compute <Datacenter> (VMWare) instance foo.sub.domain.tld: undefined method `[]' for nil:NilClass added
Updated by Dominic Cleal over 9 years ago
- Related to Bug #9704: Network label is unchanged on additional network interfaces with VMware templates added
Updated by Dominic Cleal over 9 years ago
#9704 (which won't be merged for a while) will fix the Network Adapter name lookup, but the Datacenter name.
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2549 added
- Pull request deleted (
)
Updated by Dominic Cleal over 9 years ago
- Translation missing: en.field_release set to 35
Updated by Anonymous over 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset e7d21bf01f2b9eee19b808c4ea320ddfd9c33b3d.
Updated by Dominic Cleal over 8 years ago
- Related to Bug #14874: Path incorrect when using vm_clone method added