Bug 1570423 - Not able to create VM using a ovf file in ovirt.
Summary: Not able to create VM using a ovf file in ovirt.
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Backup-Restore.VMs
Version: 4.2.2.6
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
: ---
Assignee: Arik
QA Contact: meital avital
bugs@ovirt.org
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-22 19:23 UTC by Pratik Narode
Modified: 2018-04-24 05:50 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-23 19:17:51 UTC
oVirt Team: Virt


Attachments (Terms of Use)
The ovf file which I am using to create the vm (10.97 KB, application/xml)
2018-04-22 19:29 UTC, Pratik Narode
no flags Details

Description Pratik Narode 2018-04-22 19:23:11 UTC
Description of problem:

I am following the examples in here: https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/export_vm_as_ova.py and trying to create a new vm using the ovf file that I have created using: https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/download_vm_ovf.py. According to the Documentation we can export an existing vm as an ova file and then can import the ova file to create new vm with same configuration. The vm configuration are all stored in ovf. 

What I am trying is, create new vm by exporting only the ovf (i.e the configuration) and not the entire ova file (considering the configuration in the ovf created by downloading the vm as ovf file and the configuration in the ovf present in the ova package, which is created by exporting the vm as ova is the same). But when I tried above I am getting error as follow and am not able to create the vm:

`ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "failed to parse a given ovf configuration ovf error: [empty name]: cannot read '//*/disksection' with value: null". HTTP response code is 400.`
 
So can someone please help me understand about, what am I doing wrong.

Thanks in Advance !!

Version-Release number of selected component (if applicable):

The Ovirt-engine version I am using is : Version 4.2.0.2-1.el7.centos

How reproducible:


Steps to Reproduce:
1. Download vm configuration data as ovf file: `ovf_file.write(vm.initialization.configuration.data)`

2. Try creating a new vm using the downloaded ovf file like: https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/upload_ova_as_vm.py#L270-L283

Actual results:
It gives an error saying:
`ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "failed to parse a given ovf configuration ovf error: [empty name]: cannot read '//*/disksection' with value: null". HTTP response code is 400.`

Expected results:
As per what I am assuming/thinking (and Please correct if I am wrong), it should create a new vm with same configuration as of the vm we downloaded as ovf.

Additional info:

Comment 1 Pratik Narode 2018-04-22 19:29:16 UTC
Created attachment 1425439 [details]
The ovf file which I am using to create the vm

Comment 2 Pratik Narode 2018-04-23 19:08:34 UTC
I have changed the ConfigurationType over here: https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/upload_ova_as_vm.py#L278 to types.ConfigurationType.OVF But still not able to create a vm. But the error is changed and I am getting error as:

Error:
ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "[General command validation failure.]". HTTP response code is 500.

Can someone please help me with this or atleast point me to what am I doing wrong.

Thanks,
Pratik

Comment 3 Pratik Narode 2018-04-23 19:17:23 UTC
I think I found what I was doing wrong. After I have changed the ConfigurationTypes, the part I was doing wrong was using wrong ovf file to create the vm. I was using the ovf that I created by exporting the template to create a vm. So I freshly exported my vm to create a new ovf, deleted the vm and added create a new vm using the configuration ovf and it worked.

So I am closing this bug.

Thanks,
Pratik

Comment 4 Arik 2018-04-23 19:42:51 UTC
(In reply to Pratik Narode from comment #3)
Well done :)
Yeah, the OVF in attachment 1425439 [details] seems to be one that was created when exporting to an export domain or in OVF store - it is quite a bit different than one we create for OVAs, so when using such an OVF then ConfigurationType.OVF should be used.
And yeah, there are some differences between templates' OVFs and VMs' OVFs when it comes to this kind of OVFs and that would typically cause such an attempt to import a VM from template's OVF to fail.

Comment 5 Pratik Narode 2018-04-24 05:50:27 UTC
(In reply to Arik from comment #4)
> (In reply to Pratik Narode from comment #3)
> Well done :)
> Yeah, the OVF in attachment 1425439 [details] seems to be one that was
> created when exporting to an export domain or in OVF store - it is quite a
> bit different than one we create for OVAs, so when using such an OVF then
> ConfigurationType.OVF should be used.
> And yeah, there are some differences between templates' OVFs and VMs' OVFs
> when it comes to this kind of OVFs and that would typically cause such an
> attempt to import a VM from template's OVF to fail.

Thanks for the Clarification. Yes I realised later that the OVF's created by exporting VM as OVA is different then OVF created by directly exporting vm as OVF.


Note You need to log in before you can comment on or make changes to this bug.