[Pkg-libvirt-commits] [libguestfs] 17/29: v2v: OVF: If actual_size field is estimated, add a comment to the output.
Hilko Bengen
bengen at moszumanska.debian.org
Sun Nov 1 17:14:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag upstream/1.29.48
in repository libguestfs.
commit 52ca4d5dd4c909a4eac8c6f3a58f8800a444a611
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Mon Jun 29 10:41:10 2015 +0100
v2v: OVF: If actual_size field is estimated, add a comment to the output.
The 'note:' comment is added, as below:
<Section xsi:type='ovf:DiskSection_Type'>
<Info>List of Virtual Disks</Info>
<!-- note: actual_size field is estimated -->
<Disk ovf:actual_size='7' [...]/>
</Section>
---
v2v/OVF.ml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/v2v/OVF.ml b/v2v/OVF.ml
index 729120f..68cd00f 100644
--- a/v2v/OVF.ml
+++ b/v2v/OVF.ml
@@ -373,14 +373,14 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf =
b /^ 1073741824L
in
let size_gb = bytes_to_gb ov.ov_virtual_size in
- let actual_size_gb =
+ let actual_size_gb, is_estimate =
match t.target_actual_size, t.target_estimated_size with
- | Some actual_size, _ -> Some (bytes_to_gb actual_size)
+ | Some actual_size, _ -> Some (bytes_to_gb actual_size), false
(* In the --no-copy case the target file does not exist. In
* that case we use the estimated size.
*)
- | None, Some estimated_size -> Some (bytes_to_gb estimated_size)
- | None, None -> None in
+ | None, Some estimated_size -> Some (bytes_to_gb estimated_size), true
+ | None, None -> None, false in
let format_for_rhev =
match t.target_format with
@@ -428,6 +428,10 @@ and add_disks targets guestcaps output_alloc sd_uuid image_uuids vol_uuids ovf =
| Some actual_size_gb ->
("ovf:actual_size", Int64.to_string actual_size_gb) :: attrs in
e "Disk" attrs [] in
+ if is_estimate then (
+ let comment = Comment "note: actual_size field is estimated" in
+ append_child comment disk_section
+ );
append_child disk disk_section;
(* Add disk to VirtualHardware. *)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list