[Libguestfs] [PATCH v2 2/4] v2v: copy virtio drivers without guestfs handle leak

Richard W.M. Jones rjones at redhat.com
Wed Oct 14 08:41:50 UTC 2015


Some more problems:

On Tue, Oct 13, 2015 at 03:50:52PM +0300, Roman Kagan wrote:
> +        let g2 = new Guestfs.guestfs () in
> +        if trace () then g2#set_trace true;
> +        if verbose () then g2#set_verbose true;
> +        g2#add_drive_opts virtio_win ~readonly:true;
> +        g2#launch ();

This ends up dropping the change made in commit
bd0b52d08e1fbffc947eae9274ae30cf3a17737e.  Please add it back.

> +        let vio_root = "/" in
> +        g2#mount_ro "/dev/sda" vio_root;
> +        let paths = g2#find vio_root in
> +        Array.iter (
> +          fun path ->
> +            let source = vio_root // path in
> +            if (g2#is_file source ~followsymlinks:false) &&
> +               (match_vio_path_with_os path inspect.i_arch
> +                inspect.i_major_version inspect.i_minor_version
> +                inspect.i_product_variant) then (

Just pass the 'inspect' struct here, rather than the individual
fields.  It's less code and more type safe.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list