From 75e8b1386766b18aecefdc8a75fbbf85ddb52037 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 18 Jun 2018 10:31:18 +0100 Subject: [PATCH] v2v: changed to the actual size (if known). Note that this attribute is optional. Thanks: Arik Hadas --- v2v/create_ovf.ml | 11 ++++++++--- v2v/test-v2v-o-rhv.ovf.expected | 2 +- v2v/test-v2v-o-rhv.sh | 1 + v2v/test-v2v-o-vdsm-options.ovf.expected | 2 +- v2v/test-v2v-o-vdsm-options.sh | 1 + 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml index e0f81e0a2..9e0c772fd 100644 --- a/v2v/create_ovf.ml +++ b/v2v/create_ovf.ml @@ -819,12 +819,17 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids (* Add disk to node. *) let disk = - e "File" [ + let attrs = ref [ "ovf:href", fileref; "ovf:id", vol_uuid; - "ovf:size", Int64.to_string ov.ov_virtual_size; (* NB: in bytes *) "ovf:description", generated_by; - ] [] in + ] in + (match t.target_actual_size with + | None -> () + | Some actual_size -> + List.push_back attrs ("ovf:size", Int64.to_string actual_size) + ); + e "File" !attrs [] in append_child disk references; (* Add disk to DiskSection. *) diff --git a/v2v/test-v2v-o-rhv.ovf.expected b/v2v/test-v2v-o-rhv.ovf.expected index 1deec9c9d..7bcc456c5 100644 --- a/v2v/test-v2v-o-rhv.ovf.expected +++ b/v2v/test-v2v-o-rhv.ovf.expected @@ -2,7 +2,7 @@ - +
List of networks diff --git a/v2v/test-v2v-o-rhv.sh b/v2v/test-v2v-o-rhv.sh index c9ec0dbce..eb22ed95b 100755 --- a/v2v/test-v2v-o-rhv.sh +++ b/v2v/test-v2v-o-rhv.sh @@ -74,6 +74,7 @@ sed -i \ -e "s/$DISK_ID/#DISK_ID#/g" \ -e "s/$VM_ID/#VM_ID#/g" \ -e "s/$VOL_ID/#VOL_ID#/g" \ + -e "s/\('"$RE_UUID"'#UUID#[^<]*#DATE# - + List of networks diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh index 2c9de5eb7..c70446aa1 100755 --- a/v2v/test-v2v-o-vdsm-options.sh +++ b/v2v/test-v2v-o-vdsm-options.sh @@ -82,6 +82,7 @@ RE_UUID='\<[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[ # Filter variable strings sed -i \ + -e "s/\('"$RE_UUID"'#UUID#[^<]*#DATE#