[Pkg-libvirt-commits] [libguestfs] 02/179: v2v: Print the difference between our disk size estimate and actual size.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 31 19:07:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 25274b4f75196f77c891d8e858644ad0df1ad6f0
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Thu Oct 2 13:01:12 2014 +0100

    v2v: Print the difference between our disk size estimate and actual size.
---
 v2v/v2v.ml | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index ddeee18..8943457 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -331,7 +331,29 @@ let rec main () =
           (* Calculate the actual size on the target, returns an updated
            * target structure.
            *)
-          actual_target_size t
+          let t = actual_target_size t in
+
+          (* If verbose, find out how close the estimate was.  This is
+           * for developer information only - so we can increase the
+           * accuracy of the estimate.
+           *)
+          if verbose then (
+            match t.target_estimated_size, t.target_actual_size with
+            | None, None | None, Some _ | Some _, None | Some _, Some 0L -> ()
+            | Some estimate, Some actual ->
+              let pc =
+                100. *. Int64.to_float estimate /. Int64.to_float actual
+                -. 100. in
+              printf "%s: estimate %Ld (%s) versus actual %Ld (%s): %.1f%%"
+                t.target_overlay.ov_sd
+                estimate (human_size estimate)
+                actual (human_size actual)
+                pc;
+              if pc < 0. then printf " ! ESTIMATE TOO LOW !";
+              printf "\n";
+          );
+
+          t
       ) targets
     ) (* do_copy *) in
 

-- 
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