[Libguestfs] [PATCH] v2v: Add <Disk ovf:capacity> attribute containing disk virtual size.

Richard W.M. Jones rjones at redhat.com
Mon Jun 18 09:41:32 UTC 2018


Required ever since this change was made to oVirt:
https://gerrit.ovirt.org/#/c/91902/

Thanks: Arik Hadas
---
 v2v/create_ovf.ml                        | 1 +
 v2v/test-v2v-o-rhv.ovf.expected          | 2 +-
 v2v/test-v2v-o-vdsm-options.ovf.expected | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml
index ac3c61b13..e0f81e0a2 100644
--- a/v2v/create_ovf.ml
+++ b/v2v/create_ovf.ml
@@ -835,6 +835,7 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids
           | OVirt -> image_uuid
           | RHVExportStorageDomain -> vol_uuid);
           "ovf:size", Int64.to_string size_gb;
+          "ovf:capacity", Int64.to_string ov.ov_virtual_size;
           "ovf:fileRef", fileref;
           "ovf:parentRef", "";
           "ovf:vm_snapshot_id", uuidgen ();
diff --git a/v2v/test-v2v-o-rhv.ovf.expected b/v2v/test-v2v-o-rhv.ovf.expected
index 342eb99d3..1deec9c9d 100644
--- a/v2v/test-v2v-o-rhv.ovf.expected
+++ b/v2v/test-v2v-o-rhv.ovf.expected
@@ -10,7 +10,7 @@
   </Section>
   <Section xsi:type='ovf:DiskSection_Type'>
     <Info>List of Virtual Disks</Info>
-    <Disk ovf:diskId='#VOL_ID#' ovf:size='1' ovf:fileRef='#DISK_ID#/#VOL_ID#' ovf:parentRef='' ovf:vm_snapshot_id='#UUID#' ovf:volume-format='RAW' ovf:volume-type='Sparse' ovf:format='http://en.wikipedia.org/wiki/Byte' ovf:disk-interface='VirtIO' ovf:disk-type='System' ovf:boot='True' ovf:actual_size='1'/>
+    <Disk ovf:diskId='#VOL_ID#' ovf:size='1' ovf:capacity='536870912' ovf:fileRef='#DISK_ID#/#VOL_ID#' ovf:parentRef='' ovf:vm_snapshot_id='#UUID#' ovf:volume-format='RAW' ovf:volume-type='Sparse' ovf:format='http://en.wikipedia.org/wiki/Byte' ovf:disk-interface='VirtIO' ovf:disk-type='System' ovf:boot='True' ovf:actual_size='1'/>
   </Section>
   <Content ovf:id='out' xsi:type='ovf:VirtualSystem_Type'>
     <Name>windows</Name>
diff --git a/v2v/test-v2v-o-vdsm-options.ovf.expected b/v2v/test-v2v-o-vdsm-options.ovf.expected
index af1ca01db..c2a3e336c 100644
--- a/v2v/test-v2v-o-vdsm-options.ovf.expected
+++ b/v2v/test-v2v-o-vdsm-options.ovf.expected
@@ -10,7 +10,7 @@
   </NetworkSection>
   <DiskSection>
     <Info>List of Virtual Disks</Info>
-    <Disk ovf:diskId='IMAGE' ovf:size='1' ovf:fileRef='VOL' ovf:parentRef='' ovf:vm_snapshot_id='#UUID#' ovf:volume-format='COW' ovf:volume-type='Sparse' ovf:format='http://en.wikipedia.org/wiki/Byte' ovf:disk-interface='VirtIO' ovf:disk-type='System' ovf:boot='True' ovf:actual_size='1'/>
+    <Disk ovf:diskId='IMAGE' ovf:size='1' ovf:capacity='536870912' ovf:fileRef='VOL' ovf:parentRef='' ovf:vm_snapshot_id='#UUID#' ovf:volume-format='COW' ovf:volume-type='Sparse' ovf:format='http://en.wikipedia.org/wiki/Byte' ovf:disk-interface='VirtIO' ovf:disk-type='System' ovf:boot='True' ovf:actual_size='1'/>
   </DiskSection>
   <VirtualSystem ovf:id='VM'>
     <Name>windows</Name>
-- 
2.16.2




More information about the Libguestfs mailing list