[Libguestfs] [PATCH v3] resize: support non-local output disks (RHBZ#1404182)

Richard W.M. Jones rjones at redhat.com
Mon Feb 6 15:19:10 UTC 2017


On Mon, Feb 06, 2017 at 03:59:52PM +0100, Pino Toscano wrote:
> Parse the output disk as URI, and use all its attributes just like
> it is done for the input disk.  The only change is that the fsync of the
> output disk is limited now for local URIs only, since it will not work
> with remote protocols.

ACK.

I'll just note a possible simplification ...

> +  (* Add a drive to an handle using the elements of the URI,
> +   * and few additional parameters.
> +   *)
> +  let add_drive_uri (g : Guestfs.guestfs) ?format ?readonly ?cachemode
> +    uri =
> +    let { URI.path = path; protocol = protocol;
> +          server = server; username = username;
> +          password = password } = uri in

You could unpack the uri in the parameters if you wanted:

let add_drive_uri (g : Guestfs.guestfs) ?format ?readonly ?cachemode
                  { URI.path = path; protocol = protocol;
                    server = server; username = username;
                    password = password } =
   g#add_drive ?format ?readonly ?cachemode
              ~protocol ?server ?username ?secret:password path
in

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




More information about the Libguestfs mailing list