Blame SOURCES/0227-v2v-o-rhev-o-vdsm-Review-XML-based-on-oVirt-descript.patch

ffd6ed
From f8c2830f2143de20285ce5bffb86597586be1fa0 Mon Sep 17 00:00:00 2001
ffd6ed
From: "Richard W.M. Jones" <rjones@redhat.com>
ffd6ed
Date: Mon, 7 Sep 2015 13:30:04 +0100
ffd6ed
Subject: [PATCH] v2v: -o rhev, -o vdsm: Review XML based on oVirt description
ffd6ed
 of format.
ffd6ed
ffd6ed
After reviewing http://www.ovirt.org/images/8/86/Ovirt_ovf_format.odt
ffd6ed
this commit makes some small revisions to the OVF that we generate.
ffd6ed
ffd6ed
Possible fix for https://bugzilla.redhat.com/show_bug.cgi?id=1260590
ffd6ed
ffd6ed
(cherry picked from commit 829e3fe7a6ed834939a7a79e453ab873d3328ae1)
ffd6ed
---
ffd6ed
 v2v/OVF.ml | 23 +++++++++++++++--------
ffd6ed
 1 file changed, 15 insertions(+), 8 deletions(-)
ffd6ed
ffd6ed
diff --git a/v2v/OVF.ml b/v2v/OVF.ml
ffd6ed
index b8a9a38..2ebb00f 100644
ffd6ed
--- a/v2v/OVF.ml
ffd6ed
+++ b/v2v/OVF.ml
ffd6ed
@@ -16,7 +16,11 @@
ffd6ed
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
ffd6ed
  *)
ffd6ed
 
ffd6ed
-(* Functions for dealing with OVF files. *)
ffd6ed
+(* Functions for dealing with OVF files.
ffd6ed
+ *
ffd6ed
+ * The format is described in
ffd6ed
+ * http://www.ovirt.org/images/8/86/Ovirt_ovf_format.odt
ffd6ed
+ *)
ffd6ed
 
ffd6ed
 open Common_gettext.Gettext
ffd6ed
 open Common_utils
ffd6ed
@@ -31,7 +35,7 @@ open DOM
ffd6ed
 let title = sprintf "Exported by virt-v2v %s" Config.package_version
ffd6ed
 
ffd6ed
 (* We set the creation time to be the same for all dates in
ffd6ed
- * all metadata files.
ffd6ed
+ * all metadata files.  All dates in OVF are UTC.
ffd6ed
  *)
ffd6ed
 let time = time ()
ffd6ed
 let iso_time =
ffd6ed
@@ -271,11 +275,11 @@ let rec create_ovf verbose source targets guestcaps inspect
ffd6ed
         e "IsStateless" [] [PCData "False"];
ffd6ed
         e "Origin" [] [PCData "0"];
ffd6ed
         e "VmType" [] [PCData vmtype];
ffd6ed
-        e "DefaultDisplayType" [] [PCData "1"];
ffd6ed
+        e "DefaultDisplayType" [] [PCData "1" (* qxl *)];
ffd6ed
 
ffd6ed
         e "Section" ["ovf:id", vm_uuid; "ovf:required", "false";
ffd6ed
                      "xsi:type", "ovf:OperatingSystemSection_Type"] [
ffd6ed
-          e "Info" [] [PCData "Guest Operating System"];
ffd6ed
+          e "Info" [] [PCData inspect.i_product_name];
ffd6ed
           e "Description" [] [PCData ostype];
ffd6ed
         ];
ffd6ed
 
ffd6ed
@@ -299,14 +303,15 @@ let rec create_ovf verbose source targets guestcaps inspect
ffd6ed
           ];
ffd6ed
           e "Item" [] [
ffd6ed
             e "rasd:Caption" [] [PCData "USB Controller"];
ffd6ed
-            e "rasd:InstanceId" [] [PCData "4"];
ffd6ed
+            e "rasd:InstanceId" [] [PCData "3"];
ffd6ed
             e "rasd:ResourceType" [] [PCData "23"];
ffd6ed
             e "rasd:UsbPolicy" [] [PCData "Disabled"];
ffd6ed
           ];
ffd6ed
           e "Item" [] [
ffd6ed
             e "rasd:Caption" [] [PCData "Graphical Controller"];
ffd6ed
-            e "rasd:InstanceId" [] [PCData "5"];
ffd6ed
+            e "rasd:InstanceId" [] [PCData (uuidgen ~prog ())];
ffd6ed
             e "rasd:ResourceType" [] [PCData "20"];
ffd6ed
+            e "Type" [] [PCData "video"];
ffd6ed
             e "rasd:VirtualQuantity" [] [PCData "1"];
ffd6ed
             e "rasd:Device" [] [PCData "qxl"];
ffd6ed
           ]
ffd6ed
@@ -365,7 +370,7 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf =
ffd6ed
     fun i ({ target_overlay = ov } as t, image_uuid, vol_uuid) ->
ffd6ed
       let is_boot_drive = i == 0 in
ffd6ed
 
ffd6ed
-      let fileref = image_uuid // vol_uuid in
ffd6ed
+      let fileref = sprintf "%s/%s" image_uuid vol_uuid in
ffd6ed
 
ffd6ed
       (* ovf:size and ovf:actual_size fields are integer GBs.  If you
ffd6ed
        * use floating point numbers then RHEV will fail to parse them.
ffd6ed
@@ -447,6 +452,7 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf =
ffd6ed
           e "rasd:Caption" [] [PCData caption];
ffd6ed
           e "rasd:InstanceId" [] [PCData vol_uuid];
ffd6ed
           e "rasd:ResourceType" [] [PCData "17"];
ffd6ed
+          e "Type" [] [PCData "disk"];
ffd6ed
           e "rasd:HostResource" [] [PCData fileref];
ffd6ed
           e "rasd:Parent" [] [PCData "00000000-0000-0000-0000-000000000000"];
ffd6ed
           e "rasd:Template" [] [PCData "00000000-0000-0000-0000-000000000000"];
ffd6ed
@@ -498,10 +504,11 @@ and add_networks nics guestcaps ovf =
ffd6ed
 
ffd6ed
       let item =
ffd6ed
         let children = [
ffd6ed
-          e "rasd:InstanceId" [] [PCData "3"];
ffd6ed
+          e "rasd:InstanceId" [] [PCData (uuidgen ~prog ())];
ffd6ed
           e "rasd:Caption" [] [PCData (sprintf "Ethernet adapter on %s" vnet)];
ffd6ed
           e "rasd:ResourceType" [] [PCData "10"];
ffd6ed
           e "rasd:ResourceSubType" [] [PCData model];
ffd6ed
+          e "Type" [] [PCData "interface"];
ffd6ed
           e "rasd:Connection" [] [PCData vnet];
ffd6ed
           e "rasd:Name" [] [PCData dev];
ffd6ed
         ] in
ffd6ed
-- 
ffd6ed
1.8.3.1
ffd6ed