[Libguestfs] [PATCH v2 2/2] v2v: -i vmx: Enhance VMX support with ability to use ‘-it ssh’ transport.

Pino Toscano ptoscano at redhat.com
Fri Dec 8 17:04:51 UTC 2017


On Friday, 8 December 2017 17:02:30 CET Richard W.M. Jones wrote:
> This enhances the existing VMX input support allowing it to be
> used over SSH to the ESXi server.
> 
> The original command (for local .vmx files) was:
> 
>  $ virt-v2v -i vmx guest.vmx -o local -os /var/tmp
> 
> Adding ‘-it ssh’ and using an SSH remote path gives the new syntax:
> 
>  $ virt-v2v \
>      -i vmx -it ssh \
>      "root at esxi.example.com:/vmfs/volumes/datastore1/guest/guest.vmx" \
>      -o local -os /var/tmp
> 
> I anticipate that this input method will be widely used enough that it
> deserves its own example at the top of the man page.
> ---
> [...]
> +(* The single filename on the command line is intepreted either as
> + * a local file or a remote SSH path (only if ‘-it ssh’).
> + *)
> +let vmx_source_of_arg input_transport arg =
> +  match input_transport, arg with
> +  | None, arg -> File arg
> +  | Some `SSH, arg ->
> +     let arg1, path = String.split ":" arg in
> +     if path = "" then
> +       error (f_"expecting [user@]server:path with ‘-it ssh’");
> +     let user, server = match String.split "@" arg1 with
> +       | server, "" -> None, server
> +       | user, server -> Some user, server in
> +     SSH (user, server, path)

IMHO this new transport could use the standard URI syntax, so
 root at esxi.example.com/vmfs/volumes/datastore1/guest/guest.vmx
instead of 
 root at esxi.example.com:/vmfs/volumes/datastore1/guest/guest.vmx

This way, Xml.parse_uri can be used to parse it, giving a better code
for extracting all the parts (including the port, for example).

The rest seems fine, at a quick glance.

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


More information about the Libguestfs mailing list