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