[Pkg-libvirt-commits] [libguestfs] 171/266: v2v: Remove Types.overlay ov_preallocation field.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:58 UTC 2014


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

bengen pushed a commit to annotated tag debian/1%1.27.35-1
in repository libguestfs.

commit 938fe047d087f6a8e0bd79f7e275948a60eb1508
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Mon Aug 25 20:22:19 2014 +0100

    v2v: Remove Types.overlay ov_preallocation field.
    
    The ov_preallocation field was essentially an implementation detail of
    the V2v module.  There was no need to carry it around in the overlay
    struct, and nothing else used it.  This also allows us to simplify
    other code.
---
 v2v/types.ml  |  3 ---
 v2v/types.mli |  1 -
 v2v/v2v.ml    | 24 +++++++++++-------------
 3 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/v2v/types.ml b/v2v/types.ml
index 688f009..576736a 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -123,7 +123,6 @@ type overlay = {
   ov_target_format : string;
   ov_sd : string;
   ov_virtual_size : int64;
-  ov_preallocation : string option;
   ov_source_file : string;
   ov_source_format : string option;
 }
@@ -135,7 +134,6 @@ ov_target_file = %s
 ov_target_format = %s
 ov_sd = %s
 ov_virtual_size = %Ld
-ov_preallocation = %s
 ov_source_file = %s
 ov_source_format = %s
 "
@@ -144,7 +142,6 @@ ov_source_format = %s
     ov.ov_target_format
     ov.ov_sd
     ov.ov_virtual_size
-    (match ov.ov_preallocation with None -> "None" | Some s -> s)
     ov.ov_source_file
     (match ov.ov_source_format with None -> "None" | Some s -> s)
 
diff --git a/v2v/types.mli b/v2v/types.mli
index 16babca..a2ef094 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -73,7 +73,6 @@ type overlay = {
   ov_target_format : string; (** Destination format (eg. -of option). *)
   ov_sd : string;            (** sdX libguestfs name of disk. *)
   ov_virtual_size : int64;   (** Virtual disk size in bytes. *)
-  ov_preallocation : string option;     (** ?preallocation option. *)
 
   (* Note: the next two fields are for information only and must not
    * be opened/copied/etc.
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 86737b8..1f3546f 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -133,7 +133,7 @@ let rec main () =
   msg (f_"Initializing the target %s") output#as_options;
   let overlays =
     initialize_target ~verbose g
-      source output output_alloc output_format output_name overlays in
+      source output output_format output_name overlays in
 
   (* Inspection - this also mounts up the filesystems. *)
   msg (f_"Inspecting the overlay");
@@ -209,7 +209,14 @@ let rec main () =
          * create the disk explicitly using libguestfs then pass the
          * 'qemu-img convert -n' option so qemu reuses the disk.
          *)
-        let preallocation = ov.ov_preallocation in
+        (* What output preallocation mode should we use? *)
+        let preallocation =
+          match ov.ov_target_format, output_alloc with
+          | "raw", `Sparse -> Some "sparse"
+          | "raw", `Preallocated -> Some "full"
+          | "qcow2", `Sparse -> Some "off" (* ? *)
+          | "qcow2", `Preallocated -> Some "metadata"
+          | _ -> None (* ignore -oa flag for other formats *) in
         let compat =
           match ov.ov_target_format with "qcow2" -> Some "1.1" | _ -> None in
         (new G.guestfs ())#disk_create ov.ov_target_file
@@ -236,7 +243,7 @@ let rec main () =
     Gc.compact ()
 
 and initialize_target ~verbose g
-    source output output_alloc output_format output_name overlays =
+    source output output_format output_name overlays =
   let overlays =
     mapi (
       fun i (overlay, qemu_uri, backing_format) ->
@@ -253,19 +260,10 @@ and initialize_target ~verbose g
           | None, None ->
             error (f_"disk %s (%s) has no defined format, you have to either define the original format in the source metadata, or use the '-of' option to force the output format") sd qemu_uri in
 
-        (* What output preallocation mode should we use? *)
-        let preallocation =
-          match format, output_alloc with
-          | "raw", `Sparse -> Some "sparse"
-          | "raw", `Preallocated -> Some "full"
-          | "qcow2", `Sparse -> Some "off" (* ? *)
-          | "qcow2", `Preallocated -> Some "metadata"
-          | _ -> None (* ignore -oa flag for other formats *) in
-
         { ov_overlay = overlay;
           ov_target_file = "";
           ov_target_format = format;
-          ov_sd = sd; ov_virtual_size = vsize; ov_preallocation = preallocation;
+          ov_sd = sd; ov_virtual_size = vsize;
           ov_source_file = qemu_uri; ov_source_format = backing_format }
     ) overlays in
   let overlays = output#prepare_output source overlays 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