Unable to import templates with 5.4.1? Ruby Error?

(Brian Flanagan) #1

Please, describe the problem here and provide additional information below (if applicable)

Added vcenter and host/datastore to 5.4.1 install, went to import template and get a error " There was an error trying to create an image for disk in vcenter template. Reason: ManagedObjectNotFound: The object ‘vim.VirtualMachine:undefined’ has already been deleted or has not been completely created "

The template and souce VM are fine in vCenter. Never seen this before.

Versions of the related components and OS (frontend, hypervisors, VMs):

vCenter 6.5 U1, Host is 6.0.0, 2494585

Steps to reproduce:
Import existing VM template
Current results:

Fails with

There was an error trying to create an image for disk in vcenter template. Reason: ManagedObjectNotFound: The object ‘vim.VirtualMachine:undefined’ has already been deleted or has not been completely created ["/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/connection.rb:61:in parse_response'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/connection.rb:90:incall’", “/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:211:in _call'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:74:inblock (2 levels) in init’”, “/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:189:in _get_property'", "/usr/lib/one/ruby/vendors/rbvmomi/lib/rbvmomi/basic_types.rb:35:inblock (2 levels) in init’”, “/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:78:in get_dc'", "/usr/lib/one/ruby/vcenter_driver/virtual_machine.rb:230:inimport_vcenter_disks’”, “/usr/lib/one/sunstone/routes/vcenter.rb:338:in block in '", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:incall’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in block in compile!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in[]’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in block (3 levels) in route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:inroute_eval’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in block (2 levels) in route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:inblock in process_route’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in catch'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:inprocess_route’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in block in route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:ineach’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in route!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:inblock in dispatch!’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in block in invoke'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:incatch’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in invoke'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:indispatch!’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in block in call!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:inblock in invoke’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in catch'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:ininvoke’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in call!'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:incall’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/commonlogger.rb:33:in call'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:219:incall’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/deflater.rb:35:in call'", "/usr/local/share/gems/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:incontext’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in call'", "/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:incall’”, “/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in call'", "/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:incall’”, “/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in call'", "/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:incall’”, “/usr/local/share/gems/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in call'", "/usr/local/share/gems/gems/rack-1.6.4/lib/rack/nulllogger.rb:9:incall’”, “/usr/local/share/gems/gems/rack-1.6.4/lib/rack/head.rb:13:in call'", "/usr/local/share/gems/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:incall’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/show_exceptions.rb:25:in call'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:incall’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in call'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:inblock in call’”, “/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1787:in synchronize'", "/usr/local/share/gems/gems/sinatra-1.4.7/lib/sinatra/base.rb:1487:incall’”, “/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:86:in block in pre_process'", "/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:84:incatch’”, “/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:84:in pre_process'", "/usr/local/share/gems/gems/thin-1.7.0/lib/thin/connection.rb:50:inblock in process’”, “/usr/local/share/gems/gems/eventmachine- call'", "/usr/local/share/gems/gems/eventmachine- in spawn_threadpool’”]

Expected results:

Imported template

(Brian Flanagan) #2

I do see this when I import the template - test- template [ Cluster: testdrs - Template location: / ]

not sure what is supposed to there for template location?

(Brian Flanagan) #3

I am getting the same error with a vCenter 5.5 and 5.5 ESX host… bizzare. I will build a totally new Nebula host/DB env and test to see if I can reproduce this. the install of 5.4.1 and everything else via sunstone seems fine till i try to add templates.

(Pascal Kessler) #4

Hello together,

we get the same error. Environment ist vCenter 6.5 U1 (Hosts are 6.0). In a previous version of OpenNebula (eg 5.2.0) importing templates ist still working fine.

I followed the advise in the following thread: Error : Import Template Vcenter (Opennebula 5.4)

If you see tinovas post (a bit further down), but replacing the virtual_machine.rb file does not work. You run into another error message. Sorry dont have the message anymore.

Seems to be a problem with the vCenter driver (maybe :)).


(Tino Vazquez) #5

Could you please redo the test (Brian and Pascal) with the /usr/lib/one/ruby/vcenter_driver/virtual_machine.rb with the file replaced?

We need to know the exact error message. Thanks!

(Pascal Kessler) #6


thanks for your reply. I´ll rebuild it next week and tell you the result.


(Pascal Kessler) #7

Here we are!

Befor editing:

before.txt (5.2 KB)

and after changing the “.rb” file, we got the following message:

after.txt (4.6 KB)


(Антон Зубков) #8

Have same problem

(Tino Vazquez) #9

Thanks for the detailed feedback.

From the provided stack trace, this seems to be the problem:


So this is most likely a Sunstone (JavaScript) error.

  • Does it happen consistently?
  • Is it always with the same VM Template? Does it happen with only one VM Template, or with all of them?
  • Does it work when you try to import it using “onevcenter templates” CLI tool?

(Антон Зубков) #10

Import using CLI works!

(Manuel) #11

we also have the same problem.
It happens consistently with every VM template.
Importing CLI does not really work, During import it stops because of an incorrect password.
Here what I have done:
[root@vonecloud ~]# onevcenter templates --vcenter vcenter.mydomain.com --vuser vcenter_admin

Connecting to vCenter: vcenter.mydomain.com…done!

Looking for VM Templates…done!

Do you want to process datacenter Datacenter1 (y/[n])? y

  • VM Template found:

    • Name : TEMPLATE - NEBULA Ubuntu
    • Cluster : Testcluster
    • Location : 1 - 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:

    The existing disks and networks in the template are being imported, please be patient…
    Error creating disk from template: [one.image.allocate] Cannot parse image SIZE: Error calculating image vcenter://TEMPLATE - NEBULA Ubuntu/TEMPLATE - NEBULA Ubuntu.vmdk size. Reason: “InvalidLogin: Cannot complete login due to an incorrect user name or password.”

What did I do wrong? Do I have to specify other credentials than the vCenter admins?


Hi all,

I can’t reproduce it.I could read that the problem is
Trace: [VirtualMachine("undefined")]

This may be because the vcenter_ref is undefined from Sunstone. To identify the problem I need more data.

I have made a small script to run it in the chrome / firefox console to be able to know that it collects Sunstone from the request to ruby.

- Get VM Template
- Copy JS script in chrome / firefox console

trs = $("#vcenter_import_table_one1 tr");

$.each(trs, function(key, value){
console.log($(’.check_item’, value).data(“import_data”));

This script returns the data of each template, it would be interesting to send me the results of the problematic templates, and be able to detect the problem.



(Tino Vazquez) #13

Manuel, your error message seems unrelated, would you mind opening a new topic?

Pascal, UAnton, we would appreciate Abel’s requested feedback to further debug this problem. Thanks!

(Yann Bizeul) #14

Have the exact same problem.
Here is the requested debug :

Does it looks like the first item is undefined?


That’s not the problem
The first one not defined is because an assignment to a variable is not performed. Thing of the JS.

(Pascal Kessler) #16

Well thats what i got:


Im not a dev. In Sunstone, i go to the template task --> VMs --> Import:

Here i say get Template including credentials and vCenter name FQDN.

Opening a console in Firefox and run the script. Can u help me? :slight_smile:

BTW output is empty.


(Yann Bizeul) #17

You need to change the typographic quotes “‘” with bare ones on your keyboard. That’s around “.check_item” and “import_data

(Pascal Kessler) #18

Hey! Like that?

iframe is: “http://xxxxx/#templates-tab/form

(Yann Bizeul) #19

No, you are still typing typographic quotes

Replace them directly in the JS debugger, by typing "

Observe the difference in the quotes between line 1 and line 4

(Yann Bizeul) #20

I had a datastore ISO file connected in my VM, but reverting it to Client Device, didn’t solve the issue.