Bug 1401077

Summary: Improve OVA import compatibility
Product: Red Hat Enterprise Virtualization Manager Reporter: rhev-integ
Component: ovirt-engineAssignee: Shahar Havivi <shavivi>
Status: CLOSED ERRATA QA Contact: Nisim Simsolo <nsimsolo>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.0.5CC: ahadas, bgraveno, bugs, dornelas, fabrice.bacchella, gklein, juzhou, lsurette, mavital, michal.skrivanek, mxie, mzhan, nsimsolo, rbalakri, Rhev-m-bugs, rjones, shavivi, srevivo, tgolembi, tzheng, xiaodwan, ykaul
Target Milestone: ovirt-4.1.0-alphaKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
This update ensures that if an OVF file does not contain the VM Name tag, then the virtual machine is given the OVA file name.
Story Points: ---
Clone Of: 1371843
: 1401848 (view as bug list) Environment:
Last Closed: 2017-04-25 00:42:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1371843, 1402301    
Bug Blocks: 1401848    

Description rhev-integ 2016-12-02 17:56:49 UTC
+++ This bug is an upstream to downstream clone. The original bug is: +++
+++   bug 1371843 +++
======================================================================

For it's AWS Storage Gateway, Amazon provides it's VM gateway as an OVA. But ovirt can't import it using the "import virtual machines wizard", it fails with:

File "/usr/lib/python2.7/site-packages/yajsonrpc/__init__.py", line 544, in _handle_request
    res = method(**params)
  File "/usr/lib/python2.7/site-packages/vdsm/rpc/Bridge.py", line 195, in _dynamicMethod
    result = fn(*methodArgs)
  File "/usr/share/vdsm/API.py", line 1427, in getExternalVmFromOva
    return v2v.get_ova_info(ova_path)
  File "/usr/lib/python2.7/site-packages/vdsm/v2v.py", line 197, in get_ova_info
    _add_general_ovf_info(vm, root, ns)
  File "/usr/lib/python2.7/site-packages/vdsm/v2v.py", line 1060, in _add_general_ovf_info
    raise V2VError('Error parsing ovf information: no ovf:Name')
V2VError: Error parsing ovf information: no ovf:Name

You can test it, the VM is easy to get from:
https://eu-central-1.console.aws.amazon.com/storagegateway/create

(Originally by fabrice.bacchella)

Comment 1 rhev-integ 2016-12-02 17:57:02 UTC
(In reply to Fabrice Bacchella from comment #0)
The current implementation of import OVAs is targeted for (and therefore tested with) OVAs that represent VMs exported from VMWare. This needs to be enhanced in order to support OVAs from other sources, like Amazon.

(Originally by Arik Hadas)

Comment 3 rhev-integ 2016-12-02 17:57:10 UTC
OVA and OVF are open standard specified by the DMTF. Ever you support it whatever the source is coming from, or you have a very poor and incomplete implementation that happens to support random instances.

Don't try to nitpick about where it's coming from.

(Originally by fabrice.bacchella)

Comment 4 rhev-integ 2016-12-02 17:57:18 UTC
(In reply to Fabrice Bacchella from comment #2)
> OVA and OVF are open standard specified by the DMTF. Ever you support it
> whatever the source is coming from, or you have a very poor and incomplete
> implementation that happens to support random instances.

This is the thing about it being an 'open' standard - everyone can write anything there (specifically, in the XML). And in fact, everyone does.
For example, VMware does not support our OVF - and no wonder - they have no idea what virtio is.

Same goes for Amazon.

> 
> Don't try to nitpick about where it's coming from.

Hope the above explains why it's not a nitpick.

(Originally by Yaniv Kaul)

Comment 5 rhev-integ 2016-12-02 17:57:24 UTC
I'm not talking about hardware compatibility problem, like a vmdk versus other format, or a strange network card. The problem occurs when parsing the ovf xml.

The VM I tried to import is made specifically to run in vmware. So it's a "vmware compatible" ova. That make it's failure in ovirt even more strange.

(Originally by fabrice.bacchella)

Comment 7 rhev-integ 2016-12-02 17:57:38 UTC
The OVF in the given OVA differs from OVFs that are generated by vSphere in:
1. There is no <Name> tag under <VirtualSystem>
2. The content of <rasd:HostResource> does not have the "ovf:" prefix
By adding these things, I managed to convert the given OVA.

Shahar,
1. this should be added to the code you have added in virt-v2v, right?
2. I guess we should not count on having the name of the VM inside the OVA. IMO the whole import dialog should behave differently for OVA files: when choosing OVA as a source, the user needs to specify the host and the path as today and if they are valid to go directly to the second dialog (and there we already verify that the VM name is not empty).

Fabrice, in the meantime, I suggest to extract the file (it is just a tar file), do the changes mentioned above manually and pack it again. Then you'll be able to import this VM (I also started the VM and got to the login screen).

(Originally by Arik Hadas)

Comment 8 rhev-integ 2016-12-02 17:57:46 UTC
I made your requested modification to the OVF and it works. Thanks.

(Originally by fabrice.bacchella)

Comment 9 rhev-integ 2016-12-02 17:57:54 UTC
We may need to patch vdsm and virt-v2v as well

(Originally by Shahar Havivi)

Comment 12 rhev-integ 2016-12-02 17:58:16 UTC
I've also looked at the specification referenced by Shahar[1] to make sure whether we're just fixing our mess or somebody else's mess.

(In reply to Arik from comment #6)
> The OVF in the given OVA differs from OVFs that are generated by vSphere in:
> 1. There is no <Name> tag under <VirtualSystem>

The <Name> element is not mentioned anywhere (except examples), but looking at the schema file[2] it says it's optional.

> 2. The content of <rasd:HostResource> does not have the "ovf:" prefix

This is however a different story. Specification clearly states the value is either "ovf:/file/<id>" or "ovf:/disk/<id>". So it has to include the "ovf:" prefix. See Table 3 on page 21.


[1] http://www.dmtf.org/sites/default/files/standards/documents/DSP0243_2.1.0.pdf
[2] http://schemas.dmtf.org/ovf/envelope/2/dsp8023.xsd

(Originally by Tomas Golembiovsky)

Comment 13 rhev-integ 2016-12-02 17:58:24 UTC
Patch send to virt-v2v:
https://www.redhat.com/archives/libguestfs/2016-September/msg00030.html

(Originally by Shahar Havivi)

Comment 14 rhev-integ 2016-12-02 17:58:32 UTC
(In reply to Arik from comment #6)
> 2. I guess we should not count on having the name of the VM inside the OVA.
> IMO the whole import dialog should behave differently for OVA files: when
> choosing OVA as a source, the user needs to specify the host and the path as
> today and if they are valid to go directly to the second dialog (and there
> we already verify that the VM name is not empty).

You might want an optional name field, which would translate to
passing '-on name' to virt-v2v (or not).  With Shahar's patch,
every Amazon VM will be mapped to the same name "default".

(Originally by Richard Jones)

Comment 15 rhev-integ 2016-12-02 17:58:40 UTC
> You might want an optional name field, which would translate to
> passing '-on name' to virt-v2v (or not).  With Shahar's patch,
> every Amazon VM will be mapped to the same name "default".
it is true only for conversion that will run directly virt-v2v.
vdsm is naming each vm with 'default' if the Name is not exists (current patch), and in oVirt engine you are able to name the VM regardless the ovf:name tag.

(Originally by Shahar Havivi)

Comment 16 Michal Skrivanek 2016-12-03 06:42:10 UTC
(In reply to rhev-integ from comment #0)
> +++ This bug is an upstream to downstream clone. The original bug is: +++
> +++   bug 1371843 +++
> ======================================================================

Whoever did this, next time please don't. It just messed up both original and this bug. Open a regular bug

Comment 17 Michal Skrivanek 2016-12-06 09:04:23 UTC
it is a trivial backport, let's do that in 4.0.7

Comment 20 Nisim Simsolo 2017-01-30 12:37:06 UTC
Verification builds:
ovirt-engine-4.1.0.2-0.2.el7
libvirt-client-2.0.0-10.el7_3.4.x86_64
vdsm-4.19.2-2.el7ev.x86_64
qemu-kvm-rhev-2.6.0-28.el7_3.3.x86_64
sanlock-3.4.0-1.el7.x86_64
virt-v2v-1.32.7-3.el7_3.2.x86_64