[Pkg-libvirt-commits] [libguestfs] 148/233: builder: Use disk-create API instead of calling qemu-img create.

Hilko Bengen bengen at moszumanska.debian.org
Wed Feb 19 21:11:51 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 bd12e784e78ec041b3c984620168269d716312d3
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Tue Jan 28 15:05:58 2014 +0000

    builder: Use disk-create API instead of calling qemu-img create.
---
 builder/builder.ml | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/builder/builder.ml b/builder/builder.ml
index 6dc172f..7fa3cc7 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -515,14 +515,8 @@ let main () =
       let { Index_parser.expand = expand; lvexpand = lvexpand } = entry in
       msg (f_"Resizing (using virt-resize) to expand the disk to %s")
         (human_size osize);
-      let cmd =
-        sprintf "qemu-img create -f %s%s %s %Ld%s"
-          (quote oformat)
-          (if oformat = "qcow2" then " -o preallocation=metadata" else "")
-          (quote ofile) osize
-          (if debug then "" else " >/dev/null 2>&1") in
-      if debug then eprintf "%s\n%!" cmd;
-      if Sys.command cmd <> 0 then exit 1;
+      let preallocation = if oformat = "qcow2" then Some "metadata" else None in
+      (new G.guestfs ())#disk_create ?preallocation ofile oformat osize;
       let cmd =
         sprintf "virt-resize%s%s%s --output-format %s%s%s %s %s"
           (if debug then " --verbose" else " --quiet")

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