Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1466222

Summary: oVirt appliance OVA file order doesn't conform to OVF specification
Product: [oVirt] ovirt-appliance Reporter: Michal Skrivanek <michal.skrivanek>
Component: BuildAssignee: Yuval Turgeman <yturgema>
Status: CLOSED CURRENTRELEASE QA Contact: Lukas Svaty <lsvaty>
Severity: high Docs Contact:
Priority: medium    
Version: 4.1CC: bugs, lsvaty, mgoldboi, rbarry, ylavi
Target Milestone: ovirt-4.2.7Flags: rule-engine: ovirt-4.2+
sbonazzo: devel_ack+
lsvaty: testing_ack+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: When creating an image, imagefactory searches the toplevel directory only for the ovf Consequence: The ovf file is not the first file in the ova archive Fix: Search top-level directory and subdirectories for the ovf, add it first, and then add the rest of the files Result: The ovf is the first file in the archive
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-02 14:38:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Node RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1625894    

Description Michal Skrivanek 2017-06-29 09:41:12 UTC
OVF standard defines the order in the OVA archive to require the OVF to be the first file in the archive. 
oVirt OVA is the other way around with the OVF file at the very end complicating streaming and analysis of the OVA.

Comment 1 Yuval Turgeman 2017-07-02 14:04:43 UTC
Seems to be a problem with the way imagefactory builds OVAs with subdirs, it searches for * and instead of finding the files and setting the order correctly for the ovf, it finds the top level directories and adds them blindly.

Issued a pull request here:
https://github.com/redhat-imaging/imagefactory/pull/403

Comment 2 Ryan Barry 2017-07-10 12:25:01 UTC
It looks like there's very little chance of this making it in before the 4.1.4 window closes.

Comment 5 Ryan Barry 2017-08-23 13:44:02 UTC
Still not merged upstream, so we'll need to defer it again once there's a 4.1.7 target.

Comment 6 Sandro Bonazzola 2018-06-29 16:25:54 UTC
Included in imagefactory 1.1.7, next appliance build will consume the fix.

Comment 8 Jiri Belka 2018-09-10 11:54:17 UTC
oVirt-Engine-Appliance-CentOS-x86_64-7-20180909.ova from #7

# rpm -qf /usr/lib/python2.7/site-packages/vdsm/v2v.py; rpm -qa \*v2v\*
vdsm-python-4.20.39-1.el7ev.noarch
virt-v2v-1.36.10-6.16.rhvpreview.el7ev.x86_64


2018-09-10 13:40:07,779+0200 ERROR (jsonrpc/5) [jsonrpc.JsonRpcServer] Internal server error (__init__:611)
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/yajsonrpc/__init__.py", line 606, in _handle_request
    res = method(**params)
  File "/usr/lib/python2.7/site-packages/vdsm/rpc/Bridge.py", line 201, in _dynamicMethod
    result = fn(*methodArgs)
  File "<string>", line 2, in getExternalVmFromOva
  File "/usr/lib/python2.7/site-packages/vdsm/common/api.py", line 48, in method
    ret = func(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/vdsm/API.py", line 1478, in getExternalVmFromOva
    return v2v.get_ova_info(ova_path)
  File "/usr/lib/python2.7/site-packages/vdsm/v2v.py", line 244, in get_ova_info
    _add_general_ovf_info(vm, root, ns, ova_path)
  File "/usr/lib/python2.7/site-packages/vdsm/v2v.py", line 1381, in _add_general_ovf_info
    raise V2VError('Error parsing ovf information: no memory size')
V2VError: Error parsing ovf information: no memory size

---%>---
$ tar xOf oVirt-Engine-Appliance-CentOS-x86_64-7-20180909.ova master/vms/52739e1b-9cb5-4f22-93f4-ba2979834bf6/52739e1b-9cb5-4f22-93f4-ba2979834bf6.ovf | xmllint --format -
<?xml version="1.0"?>
<ovf:Envelope xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1/" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ovf:version="0.9">
  <References>
    <File ovf:description="52739e1b-9cb5-4f22-93f4-ba2979834bf6" ovf:href="514a23c3-4efe-4df3-86c5-de00521de792/08532808-74e9-4a81-b5cc-890d61af7ca1" ovf:id="08532808-74e9-4a81-b5cc-890d61af7ca1" ovf:size="53687091200"/>
  </References>
  <Section xsi:type="ovf:NetworkSection_Type">
    <Info>List of Networks</Info>
  </Section>
  <Section xsi:type="ovf:DiskSection_Type">
    <Disk ovf:actual_size="50" ovf:boot="true" ovf:disk-interface="VirtIO" ovf:disk-type="System" ovf:diskId="08532808-74e9-4a81-b5cc-890d61af7ca1" ovf:fileRef="514a23c3-4efe-4df3-86c5-de00521de792/08532808-74e9-4a81-b5cc-890d61af7ca1" ovf:format="http://www.vmware.com/specifications/vmdk.html#sparse" ovf:parentRef="" ovf:size="50" ovf:vm_snapshot_id="4df8df45-16a9-485e-b0d4-fea677d41430" ovf:volume-format="COW" ovf:volume-type="Sparse" ovf:wipe-after-delete="false"/>
  </Section>
  <Content ovf:id="out" xsi:type="ovf:VirtualSystem_Type">
    <Name>52739e1b-9cb5-4f22-93f4-ba2979834bf6</Name>
    <TemplateId>52739e1b-9cb5-4f22-93f4-ba2979834bf6</TemplateId>
    <Description>Created by OVABuilder</Description>
    <Domain/>
    <CreationDate>2018/09/09 11:23:32</CreationDate>
    <TimeZone/>
    <IsAutoSuspend>false</IsAutoSuspend>
    <VmType>1</VmType>
    <default_display_type>0</default_display_type>
    <default_boot_sequence>1</default_boot_sequence>
    <Section ovf:id="52739e1b-9cb5-4f22-93f4-ba2979834bf6" ovf:required="false" xsi:type="ovf:OperatingSystemSection_Type">
      <Info>Guest OS</Info>
      <Description>OtherLinux</Description>
    </Section>
    <Section xsi:type="ovf:VirtualHardwareSection_Type">
      <Info>4 CPU, 16384 Memory</Info>
      <System>
        <vssd:VirtualSystemType>RHEVM 4.6.0.163</vssd:VirtualSystemType>
      </System>
      <Item>
        <rasd:Caption>4 virtual CPU</rasd:Caption>
        <rasd:Description>Number of virtual CPU</rasd:Description>
        <rasd:InstanceId>1</rasd:InstanceId>
        <rasd:ResourceType>3</rasd:ResourceType>
        <rasd:num_of_sockets>1</rasd:num_of_sockets>
        <rasd:cpu_per_socket>4</rasd:cpu_per_socket>
      </Item>
      <Item>
        <rasd:Caption>16384 MB of memory</rasd:Caption>
        <rasd:Description>Memory Size</rasd:Description>
        <rasd:InstanceId>2</rasd:InstanceId>
        <rasd:ResourceType>4</rasd:ResourceType>
        <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits>
        <rasd:VirtualQuantity>16384</rasd:VirtualQuantity>
      </Item>
      <Item>
        <rasd:Caption>Drive 1</rasd:Caption>
        <rasd:InstanceId>08532808-74e9-4a81-b5cc-890d61af7ca1</rasd:InstanceId>
        <rasd:ResourceType>17</rasd:ResourceType>
        <rasd:HostResource>514a23c3-4efe-4df3-86c5-de00521de792/08532808-74e9-4a81-b5cc-890d61af7ca1</rasd:HostResource>
        <rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
        <rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
        <rasd:ApplicationList/>
        <rasd:StorageId>00000000-0000-0000-0000-000000000000</rasd:StorageId>
        <rasd:StoragePoolId>00000000-0000-0000-0000-000000000000</rasd:StoragePoolId>
        <rasd:CreationDate>2018/09/09 11:23:32</rasd:CreationDate>
        <rasd:LastModified>2018/09/09 11:23:32</rasd:LastModified>
      </Item>
      <Item>
        <rasd:Caption>Ethernet 0 rhevm</rasd:Caption>
        <rasd:InstanceId>3</rasd:InstanceId>
        <rasd:ResourceType>10</rasd:ResourceType>
        <rasd:ResourceSubType>3</rasd:ResourceSubType>
        <rasd:Connection>rhevm</rasd:Connection>
        <rasd:Name>eth0</rasd:Name>
        <rasd:speed>1000</rasd:speed>
      </Item>
      <Item>
        <rasd:Caption>Graphics</rasd:Caption>
        <rasd:InstanceId>5</rasd:InstanceId>
        <rasd:ResourceType>20</rasd:ResourceType>
        <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
      </Item>
    </Section>
  </Content>
</ovf:Envelope>
---%<---

Comment 9 Jiri Belka 2018-09-10 11:56:17 UTC
I'm also suprised OS type is OtherLinux when it is RHEL/CentOS. This causes annoyance in oVirt engine because new VMs often by default have Other OS VM type.

Comment 10 Yuval Turgeman 2018-09-10 12:14:53 UTC
This v2v issue is tracked at bz#1622075, to verify this one, you need to check that the ovf is first on the archive

Comment 11 Yuval Turgeman 2018-09-12 10:01:34 UTC
Can we move this back to ON_QA ?

Comment 12 Jiri Belka 2018-09-17 09:14:25 UTC
I compared ovirt-engine-appliance-4.0-20160623.1.el7.centos.ova and ovirt-engine-appliance-4.2-20180912.1.el7.ova OVFs structure and I don't see any difference.

Reopen if you would find any issue.

---%>---
@@ -1,26 +1,26 @@
 <?xml version="1.0"?>
 <ovf:Envelope xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1/" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ovf:version="0.9">
   <References>
-    <File ovf:description="3a0fa979-8af3-4b03-82a4-3ef2cf404b98" ovf:href="fc5fbaa7-3687-41f2-89bb-0a419f0103d6/387d5a1a-10f0-4ada-926c-ee2036541994" ovf:id="387d5a1a-10f0-4ada-926c-ee2036541994" ovf:size="10737418240"/>
+    <File ovf:description="31980b50-4632-44cd-95c4-e24d9f35267f" ovf:href="27981236-7627-4b4f-ad1c-1aa73e1e24c2/51820f43-130b-4608-88a3-b58e4ec92f8a" ovf:id="51820f43-130b-4608-88a3-b58e4ec92f8a" ovf:size="53687091200"/>
   </References>
   <Section xsi:type="ovf:NetworkSection_Type">
     <Info>List of Networks</Info>
   </Section>
   <Section xsi:type="ovf:DiskSection_Type">
-    <Disk ovf:actual_size="10" ovf:boot="true" ovf:disk-interface="VirtIO" ovf:disk-type="System" ovf:diskId="387d5a1a-10f0-4ada-926c-ee2036541994" ovf:fileRef="fc5fbaa7-3687-41f2-89bb-0a419f0103d6/387d5a1a-10f0-4ada-926c-ee2036541994" ovf:format="http://www.vmware.com/specifications/vmdk.html#sparse" ovf:parentRef="" ovf:size="10" ovf:vm_snapshot_id="275a2140-ef38-41d0-b13d-f67336ded164" ovf:volume-format="COW" ovf:volume-type="Sparse" ovf:wipe-after-delete="false"/>
+    <Disk ovf:actual_size="50" ovf:boot="true" ovf:disk-interface="VirtIO" ovf:disk-type="System" ovf:diskId="51820f43-130b-4608-88a3-b58e4ec92f8a" ovf:fileRef="27981236-7627-4b4f-ad1c-1aa73e1e24c2/51820f43-130b-4608-88a3-b58e4ec92f8a" ovf:format="http://www.vmware.com/specifications/vmdk.html#sparse" ovf:parentRef="" ovf:size="50" ovf:vm_snapshot_id="e3a614b4-6908-44e9-a465-5f0264bc6406" ovf:volume-format="COW" ovf:volume-type="Sparse" ovf:wipe-after-delete="false"/>
   </Section>
   <Content ovf:id="out" xsi:type="ovf:VirtualSystem_Type">
-    <Name>3a0fa979-8af3-4b03-82a4-3ef2cf404b98</Name>
-    <TemplateId>3a0fa979-8af3-4b03-82a4-3ef2cf404b98</TemplateId>
+    <Name>31980b50-4632-44cd-95c4-e24d9f35267f</Name>
+    <TemplateId>31980b50-4632-44cd-95c4-e24d9f35267f</TemplateId>
     <Description>Created by OVABuilder</Description>
     <Domain/>
-    <CreationDate>2016/06/23 13:19:19</CreationDate>
+    <CreationDate>2018/09/12 11:27:13</CreationDate>
     <TimeZone/>
     <IsAutoSuspend>false</IsAutoSuspend>
     <VmType>1</VmType>
     <default_display_type>0</default_display_type>
     <default_boot_sequence>1</default_boot_sequence>
-    <Section ovf:id="3a0fa979-8af3-4b03-82a4-3ef2cf404b98" ovf:required="false" xsi:type="ovf:OperatingSystemSection_Type">
+    <Section ovf:id="31980b50-4632-44cd-95c4-e24d9f35267f" ovf:required="false" xsi:type="ovf:OperatingSystemSection_Type">
       <Info>Guest OS</Info>
       <Description>OtherLinux</Description>
     </Section>
@@ -47,16 +47,16 @@
       </Item>
       <Item>
         <rasd:Caption>Drive 1</rasd:Caption>
-        <rasd:InstanceId>387d5a1a-10f0-4ada-926c-ee2036541994</rasd:InstanceId>
+        <rasd:InstanceId>51820f43-130b-4608-88a3-b58e4ec92f8a</rasd:InstanceId>
         <rasd:ResourceType>17</rasd:ResourceType>
-        <rasd:HostResource>fc5fbaa7-3687-41f2-89bb-0a419f0103d6/387d5a1a-10f0-4ada-926c-ee2036541994</rasd:HostResource>
+        <rasd:HostResource>27981236-7627-4b4f-ad1c-1aa73e1e24c2/51820f43-130b-4608-88a3-b58e4ec92f8a</rasd:HostResource>
         <rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
         <rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
         <rasd:ApplicationList/>
         <rasd:StorageId>00000000-0000-0000-0000-000000000000</rasd:StorageId>
         <rasd:StoragePoolId>00000000-0000-0000-0000-000000000000</rasd:StoragePoolId>
-        <rasd:CreationDate>2016/06/23 13:19:19</rasd:CreationDate>
-        <rasd:LastModified>2016/06/23 13:19:19</rasd:LastModified>
+        <rasd:CreationDate>2018/09/12 11:27:13</rasd:CreationDate>
+        <rasd:LastModified>2018/09/12 11:27:13</rasd:LastModified>
       </Item>
       <Item>
         <rasd:Caption>Ethernet 0 rhevm</rasd:Caption>
---%<---

Comment 14 Sandro Bonazzola 2018-11-02 14:38:28 UTC
This bugzilla is included in oVirt 4.2.7 release, published on November 2nd 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.7 release, it has been closed with a resolution of CURRENT RELEASE.

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