diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-07-25 16:28:12 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-08-05 22:48:53 +0100 |
commit | ad3c52bd48cd1e8b24e731452e4cb1f27c074e12 (patch) | |
tree | c97b931688b5005c58ff3eb63301f467460d4d7a | |
parent | 03edaeee83944f951da3d514b64ad481eb434dbb (diff) | |
download | libguestfs-ad3c52bd48cd1e8b24e731452e4cb1f27c074e12.tar.gz libguestfs-ad3c52bd48cd1e8b24e731452e4cb1f27c074e12.tar.xz libguestfs-ad3c52bd48cd1e8b24e731452e4cb1f27c074e12.zip |
sparsify: Change code that generates qemu-img -o argument.
This is just code motion.
(cherry picked from commit 0b3b5f984c2011632c6d56e5f0ae1194d2c5074b)
-rw-r--r-- | sparsify/sparsify.ml | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml index 76b118cb..544c8abc 100644 --- a/sparsify/sparsify.ml +++ b/sparsify/sparsify.ml @@ -162,14 +162,16 @@ let overlaydisk = (* Create it with the indisk as the backing file. *) let cmd = - let backing_file_option = - sprintf "backing_file=%s%s" - (replace_str indisk "," ",,") - (match format with - | None -> "" - | Some fmt -> sprintf ",backing_fmt=%s" fmt) in + let options = + let backing_file_option = + [sprintf "backing_file=%s" (replace_str indisk "," ",,")] in + let backing_fmt_option = + match format with + | None -> [] + | Some fmt -> [sprintf "backing_fmt=%s" fmt] in + backing_file_option @ backing_fmt_option in sprintf "qemu-img create -f qcow2 -o %s %s > /dev/null" - (Filename.quote backing_file_option) (Filename.quote tmp) in + (Filename.quote (String.concat "," options)) (Filename.quote tmp) in if verbose then printf "%s\n%!" cmd; if Sys.command cmd <> 0 then |