Bug 1408124

Summary: Improve OVA import compatibility
Product: Red Hat Enterprise Linux 7 Reporter: Marcel Kolaja <mkolaja>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 7.4CC: ahadas, bugs, fabrice.bacchella, jsuchane, juzhou, kuwei, lkimlick, michal.skrivanek, mkalinin, mxie, mzhan, nsimsolo, ptoscano, rjones, shavivi, snagar, tgolembi, tzheng, xiaodwan
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.32.7-3.el7_3.2 Doc Type: Bug Fix
Doc Text:
Previously, the virt-v2v utility rejected the import of Open Virtual Appliances (OVA) without the <ovf:Name> attribute. As a consequence, the virt-v2v utility did not import OVAs exported by Amazon Web Services (AWS). To fix this bug, virt-v2v now uses the base name of the disk image file as the name of the virtual machine, if the <ovf:Name> attribute is missing. As a result, the virt-v2v utility now imports OVAs exported by Amazon Web Services.
Story Points: ---
Clone Of: 1402301 Environment:
Last Closed: 2017-01-17 18:28:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1402301    
Bug Blocks:    

Description Marcel Kolaja 2016-12-22 08:42:56 UTC
This bug has been copied from bug #1402301 and has been proposed
to be backported to 7.3 z-stream (EUS).

Comment 4 kuwei@redhat.com 2017-01-06 07:02:57 UTC
I can reproduce the issue with below builds.

virt-v2v-1.32.7-3.el7.x86_64
libguestfs-1.32.7-3.el7x86_64

Reproduce steps:

1:Prepare a RHEL 7.3 guest in ESX server。
2:Export the rhel7.3 guest as a ovf files.
3:Edit the ovf file: rhel7.3wk.ovf,and delete the <Name> tag under <VirtualSystem> and The content of <rasd:HostResource> does not have the "ovf:" prefix.
####
<VirtualSystem ovf:id="rhel7.3wk">
<Info>A virtual machine</Info>
<OperatingSystemSection ovf:id="80" ovf:version="7" vmw:osType="rhel7_64Guest">
<Info>The kind of installed guest operating system</Info>
####
<rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
####
6:Repack the files,use v2v to convert the OVA file

#virt-v2v -i ova esx-rhel6.8-ova.tar -o null -on test
[ 0.0] Opening the source -i ova esx-rhel6.8-ova.tar
virt-v2v: error: could not parse ovf:Name from OVF document

If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:

virt-v2v -v -x [...]



Try to verify this bug on below builds:
libguestfs-1.32.7-3.el7_3.2.x86_64
virt-v2v-1.32.7-3.el7_3.2.x86_64
rhv4.0: 4.0.6-3

Scenario 1:
1:Prepare a RHEL 7.3 guest in ESX server。
2:Export the rhel7.3 guest as a ovf files.
3:Edit the ovf file: rhel7.3wk.ovf,and delete the <Name> tag under <VirtualSystem> and The content of <rasd:HostResource> does not have the "ovf:" prefix.
####
<VirtualSystem ovf:id="rhel7.3wk">
<Info>A virtual machine</Info>
<OperatingSystemSection ovf:id="80" ovf:version="7" vmw:osType="rhel7_64Guest">
<Info>The kind of installed guest operating system</Info>
####
<rasd:HostResource>/disk/vmdisk1</rasd:HostResource>
####
4:Pack the files,use v2v to convert to rhv4.0.
virt-v2v -i ova rhel7.3-ova.tar -o rhev -os 10.73.131.93:/home/nfs_export -of qcow2
[ 0.0] Opening the source -i ova rhel7.3-ova.tar
virt-v2v: warning: could not parse ovf:Name from OVF document
[ 19.6] Creating an overlay to protect the source from being modified
[ 22.9] Initializing the target -o rhev -os 10.73.131.93:/home/nfs_export
[ 23.6] Opening the overlay
[ 34.5] Inspecting the overlay
[ 53.9] Checking for sufficient free disk space in the guest
[ 53.9] Estimating space required on target for each disk
[ 53.9] Converting Red Hat Enterprise Linux Server 7.2 (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 270.2] Mapping filesystem data to avoid copying unused and blank areas
[ 272.2] Closing the overlay
[ 273.7] Checking if the guest needs BIOS or UEFI to boot
[ 273.7] Assigning disks to buses
[ 273.7] Copying disk 1/1 to /tmp/v2v.19YKO9/ca31df01-aca7-441f-b10f-4f6a9b692684/images/daf947e3-bb8b-4c57-bf76-91e3edfe80c0/9f43d9c3-c575-4a10-9f0f-491b40ae4c4e (qcow2)
(100.00/100%)
[ 350.0] Creating output metadata
[ 350.1] Finishing off

5:Login rhevm and try to import the guest after finishing the conversion, but failed with below error:.
"Failed to import Vm rhel7.3-ova.tar to Data Center Default, Cluster Default".

 This issue is caused by an existing rhev4.0 bug :Bug 1378045
https://bugzilla.redhat.com/show_bug.cgi?id=1378045

 Because there is no MACAddress in the ovf configuration file which is exported from the VMware. there also is no mac address after converting this ova file by virt-v2v to export domain, checking the ovf file at export domain after v2v conversion, there is no mac address in ovf
<Item>
<rasd:InstanceId>f69e2151-ed9d-4c05-b783-d520ea3d29d3</rasd:InstanceId>
<rasd:Caption>Ethernet adapter on Network adapter 1</rasd:Caption>
<rasd:ResourceType>10</rasd:ResourceType>
<rasd:ResourceSubType>3</rasd:ResourceSubType>
<Type>interface</Type>
<rasd:Connection>Network adapter 1</rasd:Connection>
<rasd:Name>eth0</rasd:Name>
</Item>

6.If we manually add the mac address by editing the ovf file, the import the guest from export domain to data domain successfully

<Item>
<rasd:InstanceId>f69e2151-ed9d-4c05-b783-d520ea3d29d3</rasd:InstanceId>
<rasd:Caption>Ethernet adapter on Network adapter 1</rasd:Caption>
<rasd:ResourceType>10</rasd:ResourceType>
<rasd:ResourceSubType>3</rasd:ResourceSubType>
<Type>interface</Type>
<rasd:MACAddress>00:1a:4a:16:01:51</rasd:MACAddress>
<rasd:Connection>Network adapter 1</rasd:Connection>
<rasd:Name>eth0</rasd:Name>
</Item>

7.After finishing importing , power on the guest normally and checkpoint of  guest is passed

 

Scenario 2:

    1.Copy ova file which was edited by step3 of scenario1 to registered host of rhev4.0.
    2. Login rhv4.0,  Importing the ova file from rhev GUI-> virtual machines tab --> import --> select VMware virtual appliance (OVA)
    3.Guest can be import successful and checkpoint of guest is passed

 

Result:

According above verify result, the bug has been fixed by virt-v2v ,  so move the bug from ON_QA to VERIFIED

Comment 6 errata-xmlrpc 2017-01-17 18:28:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0099.html