[Libguestfs] [PATCH] sparsify: in-place: Refuse to run on overlay files (RHBZ#1277705).

Pino Toscano ptoscano at redhat.com
Wed Nov 4 10:23:44 UTC 2015


On Wednesday 04 November 2015 10:11:17 Richard W.M. Jones wrote:
> $ qemu-img create -f qcow2 -b /tmp/centos-6.img overlay.qcow2
> $ virt-sparsify --in-place overlay.qcow2
> virt-sparsify: error: disk image 'overlay.qcow2' appears to have a backing
> file.  You should use copying mode sparsification for this file (see the
> virt-sparsify(1) manual).
> 
> Thanks: Yaniv Kaul
> ---
>  sparsify/in_place.ml | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/sparsify/in_place.ml b/sparsify/in_place.ml
> index 3a2b32c..669c639 100644
> --- a/sparsify/in_place.ml
> +++ b/sparsify/in_place.ml
> @@ -30,6 +30,11 @@ open Cmdline
>  module G = Guestfs
>  
>  let rec run disk format ignores machine_readable zeroes =
> +  (* If the disk has a backing file, refuse to run (RHBZ#1277705). *)
> +  if (new G.guestfs ())#disk_has_backing_file disk then
> +    error (f_"disk image '%s' appears to have a backing file.  You should use copying mode sparsification for this file (see the virt-sparsify(1) manual).")
> +          disk;
> +
>    (* Connect to libguestfs. *)
>    let g = new G.guestfs () in
>    if trace () then g#set_trace true;

Can you please also document in virt-sparsify(1)? Looks good otherwise.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20151104/889703d2/attachment.sig>


More information about the Libguestfs mailing list