[Pkg-libvirt-commits] [libguestfs] 34/66: v2v: Allow the output mode to override disk_create.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:47:44 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.54-1
in repository libguestfs.

commit c9c5353223b09d0010bae503383cd0ed8c07fc43
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Mon Sep 22 22:10:44 2014 +0100

    v2v: Allow the output mode to override disk_create.
    
    Also we allow the output mode to actually create the disk image.  This
    lets the output mode set ownership and permissions correctly if
    required.
    
    The default method just calls Guestfs#disk_create, so there is no
    actual change in this commit.
---
 v2v/types.ml  |  1 +
 v2v/types.mli |  3 +++
 v2v/v2v.ml    | 13 +++++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/v2v/types.ml b/v2v/types.ml
index 38b6fef..d5894bc 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -198,6 +198,7 @@ class virtual output verbose = object
   method virtual as_options : string
   method virtual prepare_targets : source -> target list -> target list
   method check_target_free_space (_ : source) (_ : target list) = ()
+  method disk_create = (new Guestfs.guestfs ())#disk_create
   method virtual create_metadata : source -> target list -> guestcaps -> inspect -> unit
   method keep_serial_console = true
 end
diff --git a/v2v/types.mli b/v2v/types.mli
index 825a72b..14eea3c 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -155,6 +155,9 @@ class virtual output : bool -> object
       on the target, using the [target.target_estimated_size] field. *)
   method virtual create_metadata : source -> target list -> guestcaps -> inspect -> unit
   (** Called after conversion to finish off and create metadata. *)
+  method disk_create : ?backingfile:string -> ?backingformat:string -> ?preallocation:string -> ?compat:string -> ?clustersize:int -> string -> string -> int64 -> unit
+  (** Called in order to create disks on the target.  The method has the
+      same signature as Guestfs#disk_create. *)
   method keep_serial_console : bool
   (** Whether this output supports serial consoles (RHEV does not). *)
 end
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index bdf115d..110c092 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -292,9 +292,14 @@ let rec main () =
             error (f_"internal error: qemu corrupted the overlay file");
 
           (* It turns out that libguestfs's disk creation code is
-           * considerably more flexible and easier to use than qemu-img, so
-           * create the disk explicitly using libguestfs then pass the
-           * 'qemu-img convert -n' option so qemu reuses the disk.
+           * considerably more flexible and easier to use than
+           * qemu-img, so create the disk explicitly using libguestfs
+           * then pass the 'qemu-img convert -n' option so qemu reuses
+           * the disk.
+           *
+           * Also we allow the output mode to actually create the disk
+           * image.  This lets the output mode set ownership and
+           * permissions correctly if required.
            *)
           (* What output preallocation mode should we use? *)
           let preallocation =
@@ -306,7 +311,7 @@ let rec main () =
             | _ -> None (* ignore -oa flag for other formats *) in
           let compat =
             match t.target_format with "qcow2" -> Some "1.1" | _ -> None in
-          (new G.guestfs ())#disk_create
+          output#disk_create
             t.target_file t.target_format t.target_overlay.ov_virtual_size
             ?preallocation ?compat;
 

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