summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-15 16:37:23 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-15 16:37:23 +0000
commit43369e1bd4d98acf1cce6eb0216dcdb43d43bf1b (patch)
treef94f6f73cda89228bdf46d3ff8cbb6d9df9cdef2
parent2f321ced219eeff9a2df305fd8a621c03875893f (diff)
downloadlibguestfs-43369e1bd4d98acf1cce6eb0216dcdb43d43bf1b.tar.gz
libguestfs-43369e1bd4d98acf1cce6eb0216dcdb43d43bf1b.tar.xz
libguestfs-43369e1bd4d98acf1cce6eb0216dcdb43d43bf1b.zip
sparsify: Better error when user specifies --compress + raw output (RHBZ#852194).
-rw-r--r--sparsify/sparsify.ml37
1 files changed, 21 insertions, 16 deletions
diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml
index f9a94f5d..f77f4eb9 100644
--- a/sparsify/sparsify.ml
+++ b/sparsify/sparsify.ml
@@ -190,6 +190,27 @@ let () =
if not quiet then
printf (f_"qemu-img version %g\n%!") qemu_img_version
+(* What should the output format be? If the user specified an
+ * input format, use that, else detect it from the source image.
+ *)
+let output_format =
+ match convert with
+ | Some fmt -> fmt (* user specified output conversion *)
+ | None ->
+ match format with
+ | Some fmt -> fmt (* user specified input format, use that *)
+ | None ->
+ (* Don't know, so we must autodetect. *)
+ match (new G.guestfs ())#disk_format indisk with
+ | "unknown" ->
+ error (f_"cannot detect input disk format; use the --format parameter")
+ | fmt -> fmt
+
+(* Compression is not supported by raw output (RHBZ#852194). *)
+let () =
+ if output_format = "raw" && compress then
+ error (f_"--compress cannot be used for raw output. Remove this option or use --convert qcow2.")
+
let () =
if not quiet then
printf (f_"Create overlay file to protect source disk ...\n%!")
@@ -340,22 +361,6 @@ let () =
g#shutdown ();
g#close ()
-(* What should the output format be? If the user specified an
- * input format, use that, else detect it from the source image.
- *)
-let output_format =
- match convert with
- | Some fmt -> fmt (* user specified output conversion *)
- | None ->
- match format with
- | Some fmt -> fmt (* user specified input format, use that *)
- | None ->
- (* Don't know, so we must autodetect. *)
- match (new G.guestfs ())#disk_format indisk with
- | "unknown" ->
- error (f_"cannot detect input disk format; use the --format parameter")
- | fmt -> fmt
-
(* Now run qemu-img convert which copies the overlay to the
* destination and automatically does sparsification.
*)