On Mon, Nov 13, 2017 at 02:56:11PM +0100, Cédric Bosdonnat wrote:
> +                let g = new Guestfs.guestfs () in

Instead of this, use:

  let g = open_guestfs ~identifier:"template" () in

‘open_guestfs’ is a wrapper around ‘new guestfs’ defined in
common/mltools/tools_utils.ml which applies the --trace and --verbose
flags from the command line and lets you set a per-handle identifier
for debugging.  You can choose any useful identifier for the handle,
in case "template" is not a good one.

>            let size =
> +            let get_image_size filepath =
> +              (* If a compressed image manages to reach this code, qemu-img 
> just
> +                 returns a virtual-size equal to actual-size *)
> +              let infos = Utils.get_image_infos filepath in
> +              Yajl.object_get_number "virtual-size" infos in

Is this the right thing to do?  qemu-img info returns the compressed
size in this case, which is ... wrong (maybe?)?

If a compressed image is wrong here then you could use
detect_file_type from common/mltools/tools_utils.ml to detect that
situation.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to