Blame SOURCES/0195-v2v-OVF-If-actual_size-field-is-estimated-add-a-comm.patch

ffd6ed
From 513aea6a54e5c5b40936a072810bec3c1414f730 Mon Sep 17 00:00:00 2001
ffd6ed
From: "Richard W.M. Jones" <rjones@redhat.com>
ffd6ed
Date: Mon, 29 Jun 2015 10:41:10 +0100
ffd6ed
Subject: [PATCH] v2v: OVF: If actual_size field is estimated, add a comment to
ffd6ed
 the output.
ffd6ed
ffd6ed
The 'note:' comment is added, as below:
ffd6ed
ffd6ed
  <Section xsi:type='ovf:DiskSection_Type'>
ffd6ed
    <Info>List of Virtual Disks</Info>
ffd6ed
    
ffd6ed
    <Disk ovf:actual_size='7' [...]/>
ffd6ed
  </Section>
ffd6ed
ffd6ed
(cherry picked from commit 52ca4d5dd4c909a4eac8c6f3a58f8800a444a611)
ffd6ed
---
ffd6ed
 v2v/OVF.ml | 12 ++++++++----
ffd6ed
 1 file changed, 8 insertions(+), 4 deletions(-)
ffd6ed
ffd6ed
diff --git a/v2v/OVF.ml b/v2v/OVF.ml
ffd6ed
index 849bedd..2f0c469 100644
ffd6ed
--- a/v2v/OVF.ml
ffd6ed
+++ b/v2v/OVF.ml
ffd6ed
@@ -371,14 +371,14 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf =
ffd6ed
         b /^ 1073741824L
ffd6ed
       in
ffd6ed
       let size_gb = bytes_to_gb ov.ov_virtual_size in
ffd6ed
-      let actual_size_gb =
ffd6ed
+      let actual_size_gb, is_estimate =
ffd6ed
         match t.target_actual_size, t.target_estimated_size with
ffd6ed
-        | Some actual_size, _ -> Some (bytes_to_gb actual_size)
ffd6ed
+        | Some actual_size, _ -> Some (bytes_to_gb actual_size), false
ffd6ed
           (* In the --no-copy case the target file does not exist.  In
ffd6ed
            * that case we use the estimated size.
ffd6ed
            *)
ffd6ed
-        | None, Some estimated_size -> Some (bytes_to_gb estimated_size)
ffd6ed
-        | None, None -> None in
ffd6ed
+        | None, Some estimated_size -> Some (bytes_to_gb estimated_size), true
ffd6ed
+        | None, None -> None, false in
ffd6ed
 
ffd6ed
       let format_for_rhev =
ffd6ed
         match t.target_format with
ffd6ed
@@ -426,6 +426,10 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf =
ffd6ed
           | Some actual_size_gb ->
ffd6ed
             ("ovf:actual_size", Int64.to_string actual_size_gb) :: attrs in
ffd6ed
         e "Disk" attrs [] in
ffd6ed
+      if is_estimate then (
ffd6ed
+        let comment = Comment "note: actual_size field is estimated" in
ffd6ed
+        append_child comment disk_section
ffd6ed
+      );
ffd6ed
       append_child disk disk_section;
ffd6ed
 
ffd6ed
       (* Add disk to VirtualHardware. *)
ffd6ed
-- 
ffd6ed
1.8.3.1
ffd6ed