5.3.90 - vSphere 6.5 - Import Template failed (Distributed Switch?)

(Ulrich P.) #1


I am planning to implement (beautiful) Opennebula in our existing Vmware 6.5 environment and created a small lab to test the functionality. I am aware that 5.4 is not released so I just share my experience.

If I try to import an existing template with a NIC connected to a distributed switch I receive the following error and the import fails:

  • VM Template found:

    • Name : Win2012R2base
    • Cluster : OneLab_HA
    • Location : Templates
      Import this VM template (y/[n])? y

    For faster deployment operations and lower disk usage, OpenNebula can create new VMs as linked clones.
    Would you like to use Linked Clones with VMs based on this template (y/[n])? n

    Do you want to specify a folder where the deployed VMs based on this template will appear in vSphere’s VM and Templates section?
    If no path is set, VMs will be placed in the same location where the template lives.
    Please specify a path using slashes to separate folders e.g /Management/VMs or press Enter to use defaults: /ACME

    The existing disks and networks in the template are being imported, please be patient…
    There was an error trying to import a vcenter template: undefined method each' for nil:NilClass/ ["/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:471:inimport_vcenter_nics’", “/usr/lib/one/ruby/vcenter_driver/importer.rb:437:in block (2 levels) in import_templates'", "/usr/lib/one/ruby/vcenter_driver/importer.rb:285:ineach’”, “/usr/lib/one/ruby/vcenter_driver/importer.rb:285:in block in import_templates'", "/usr/lib/one/ruby/vcenter_driver/importer.rb:273:ineach’”, “/usr/lib/one/ruby/vcenter_driver/importer.rb:273:in import_templates'", "/usr/bin/onevcenter:128:inblock (2 levels) in '”, “/usr/lib/one/ruby/cli/command_parser.rb:449:in run'", "/usr/lib/one/ruby/cli/command_parser.rb:76:ininitialize’”, “/usr/bin/onevcenter:57:in new'", "/usr/bin/onevcenter:57:in'”]

More findings:
The same template with a NIC configured to a standard switch works just fine.
Attaching a Port from a Distributed switch while creating a new VM within Opennebula works also.

Best Regards

(Tino Vazquez) #2

Thanks for your thorough feedback! This helped a lot debugging the issue, which has two different dimensions:

  • Wild VMs with NICs in Distributed vSwitches cannot be correctly imported. For this and other reasons (like the impossibility in OpenNebula at the moment of having VM disks without an image counterpart), we decided to stop importing NICS and disks for wild VMs at the moment. New versions (maybe even the next maintenance) will include this functionality (also for KVM)


  • VM Templates with NICs in Distributed vSwitches cannot be correctly imported. This is currently a known issue which we’ll do our best to solve as soon as possible, but probably not for 5.4.0