Project

General

Profile

Actions

Bug #5630

closed

VmWare clone from template fails if Network Adator has labels in VmWare

Added by Jean-Christophe Counio about 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Compute resources - VMware
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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 issues 5 (0 open5 closed)

Related to Foreman - Bug #5483: Network label empty after cloning vware vm using image and distributed switch for networkClosedIvan Necas04/29/2014Actions
Related to Foreman - Bug #7740: Installing from VMware Image breaks distributed Port Group supportClosed09/29/2014Actions
Related to Foreman - Bug #9704: Network label is unchanged on additional network interfaces with VMware templatesClosedIvan Necas03/10/2015Actions
Related to Foreman - Bug #14874: Path incorrect when using vm_clone methodClosedTimo Goebel04/28/2016Actions
Has duplicate Foreman - Support #9956: Failed to create a compute <Datacenter> (VMWare) instance foo.sub.domain.tld: undefined method `[]' for nil:NilClassResolved03/31/2015Actions
Actions #1

Updated by Dominic Cleal about 10 years ago

  • Related to Bug #5483: Network label empty after cloning vware vm using image and distributed switch for network added
Actions #2

Updated by Dominic Cleal about 10 years ago

  • Category set to Compute resources
Actions #3

Updated by Jan Behrend about 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

Actions #4

Updated by Jan Behrend about 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

Actions #5

Updated by Dominic Cleal almost 10 years ago

  • Category changed from Compute resources to Compute resources - VMware
Actions #6

Updated by Aaron Zauner almost 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.

Actions #7

Updated by Friedrich Seifts over 9 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.

Actions #8

Updated by Friedrich Seifts over 9 years ago

Edit: This was with Foreman 1.6.1

Actions #9

Updated by Friedrich Seifts over 9 years ago

  • Related to Bug #7740: Installing from VMware Image breaks distributed Port Group support added
Actions #10

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
Actions #11

Updated by Dominic Cleal about 9 years ago

  • Related to Bug #9704: Network label is unchanged on additional network interfaces with VMware templates added
Actions #12

Updated by Dominic Cleal about 9 years ago

#9704 (which won't be merged for a while) will fix the Network Adapter name lookup, but the Datacenter name.

Actions #13

Updated by The Foreman Bot about 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2549 added
  • Pull request deleted ()
Actions #14

Updated by Dominic Cleal about 9 years ago

  • Translation missing: en.field_release set to 35
Actions #15

Updated by Anonymous about 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #16

Updated by Dominic Cleal about 8 years ago

  • Related to Bug #14874: Path incorrect when using vm_clone method added
Actions

Also available in: Atom PDF