xapi-project / vagrant-xenserver

A Vagrant provider for XenServer
MIT License
119 stars 29 forks source link

VM.import error when importing xva file from webserver; VMIsTemplate error when xva file contains template #38

Open darnells opened 7 years ago

darnells commented 7 years ago

XenServer release 6.5.0-90233c (xenenterprise)

Client: LinuxMint 17.3 (based on Ubuntu 14.04) Vagrant 1.9.1 vagrant-xenserver 0.0.12

First, I exported a VM with XenTools installed to an xva file, hosted the file on a web server, created the Vagrant box file as documented in the README, and added the box to Vagrant. I confirmed that the xva file path in the box's Vagrantfile was valid. I receive the following exception when I execute vagrant up.

Bringing machine 'default' up with 'xenserver' provider...
==> default: Downloading XVA. This may take some time. Source URL: http://myserver/ubuntu-14.04.5-desktop.xva
/home/user/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/client.rb:258:in `_do_call': ["MESSAGE_METHOD_UNKNOWN", "VM.import"] (XenApi::Errors::GenericError)
        from /home/user/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/client.rb:180:in `_call'
        from /home/user/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/dispatcher.rb:45:in `method_missing'
        from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/download_xva.rb:43:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/upload_xva.rb:93:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/upload_vhd.rb:159:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/call.rb:53:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/connect_xs.rb:36:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:225:in `action_raw'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:200:in `block in action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/environment.rb:567:in `lock'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:186:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:186:in `action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

This is the first time I have tried using the vagrant-xenserver plugin and I am not certain how to continue my troubleshooting. I would be happy to provide any additional information. Thank you for any help in resolving this issue.

jonludlam commented 7 years ago

The type of box where the xva is hosted on a webserver will only work with XS 7.0+, as I'm afraid XS 6.5 doesn't support downloading the box via an API call. I should turn this into a proper error message rather than the hideous backtrace.

darnells commented 7 years ago

@jonludlam, thanks for the quick response. I modified my workflow to include the file 'box.xva' within my box file. I got further along with this modification. A new VM is created on the XenServer, but now I am encountering a VDI_MISSING error when vagrant attempts to start the machine:

Bringing machine 'default' up with 'xenserver' provider...
/home/user/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/client.rb:258:in `_do_call': ["VDI_MISSING", "OpaqueRef:6f1321b1-8b76-e141-fd37-e28c595ad8e5", "OpaqueRef:c5880322-6ed0-1977-c73e-24dc916c7455"] (XenApi::Errors::GenericError)
    from /home/user/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/client.rb:180:in `_call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/dispatcher.rb:45:in `method_missing'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/start_vm.rb:21:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/synced_folders.rb:87:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/prepare_nfs_valid_ids.rb:12:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/provision.rb:80:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/create_vifs.rb:71:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/set_vm_params.rb:23:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/clone_vm.rb:30:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/create_template.rb:81:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/download_xva.rb:91:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/upload_xva.rb:93:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/upload_vhd.rb:159:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /home/user/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/connect_xs.rb:36:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:225:in `action_raw'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:200:in `block in action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/environment.rb:567:in `lock'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:186:in `call'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:186:in `action'
    from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

A manual start within XenCenter creates an error event with the message "This operation cannot be performed because the specified virtual disk could not be found." Is it a problem that my XenServer still has the VM template loaded that I used to create the xva file?

Your continued help is much appreciated!

darnells commented 7 years ago

The source of this error may be caused by my VM template not having an empty DVD drive: http://stackoverflow.com/questions/29256673/this-operation-cannot-be-performed-because-the-specified-virtual-disk-could-not

The .xva files I created were made manually. I was having significant problems getting packer and the packer-builder-xenserver plugin to work (installation always stalled at a waiting for ssh step). I confirmed that my DVD drives were not empty. I am correcting the issue and I am in the process of re-exporting the images.

darnells commented 7 years ago

One step forward, and then...

Bringing machine 'default' up with 'xenserver' provider...
/home/DNASTAR/darnells/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/client.rb:258:in `_do_call': ["OpaqueRef:3dfcb7b0-dfe9-7e02-7b25-ed63e58cb620", "make_into_template"] (XenApi::Errors::VMIsTemplate)
        from /home/DNASTAR/darnells/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/client.rb:180:in `_call'
        from /home/DNASTAR/darnells/.vagrant.d/gems/2.2.5/gems/xenapi-0.2.11/lib/xenapi/dispatcher.rb:45:in `method_missing'
        from /home/DNASTAR/darnells/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/upload_xva.rb:76:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /home/DNASTAR/darnells/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/upload_vhd.rb:159:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/call.rb:53:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /home/DNASTAR/darnells/.vagrant.d/gems/2.2.5/gems/vagrant-xenserver-0.0.12/lib/vagrant-xenserver/action/connect_xs.rb:36:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/warden.rb:34:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/builder.rb:116:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `block in run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/util/busy.rb:19:in `busy'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/action/runner.rb:66:in `run'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:225:in `action_raw'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:200:in `block in action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/environment.rb:567:in `lock'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:186:in `call'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/machine.rb:186:in `action'
        from /opt/vagrant/embedded/gems/gems/vagrant-1.9.1/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

I had originally exported a template. Is this an example of where the plugin expected an exported VM and fails when it cannot convert it into a template because it already is one?

darnells commented 7 years ago

And that indeed was the case. @jonludlam, I suggest that there are two items to address to close this issue:

  1. Report an error (rather than a stacktrace) when attempting to import an .xva file from a webserver url for XenServer 6.5 and below (VM.import error). As you stated, this is only supported for XenServer 7 and above.

  2. Forego the make_into_template action (rather than throw an exception) when the imported .xva file contains a template rather than a VM (VMIsTemplate error). The imported VM is just going to be converted to a template, so there is no need to fail.

jonludlam commented 7 years ago

Great, thanks for the input!