On Fri, Dec 08, 2017 at 05:55:08PM +0100, Pino Toscano wrote:
On Friday, 8 December 2017 17:02:29 CET Richard W.M. Jones wrote:
> Previously the presence of the ‘--vddk <libdir>’ option magically
> enabled VDDK mode. However we want to introduce other transports for
> VMware conversions so this wasn't a very clean choice.
>
> With this commit you must use ‘-it vddk’ to specify that you want VDDK
> as a disk transport. The previous ‘--vddk <libdir>’ option has been
> renamed to ‘--vddk-libdir <libdir>’ to be consistent with the other
> passthrough options, and it is no longer required.
>
> A new command line looks like:
>
> $ export PATH=/path/to/nbdkit:$PATH
> $ virt-v2v \
> -ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1' \
> | -it vddk \
> | --vddk-libdir /path/to/vmware-vix-disklib-distrib \
> --vddk-thumbprint xx:xx:xx:... \
> "Windows 2003" \
> -o local -os /var/tmp
>
> where only the two lines marked with ‘|’ have changed.
> ---
> [...]
> @@ -286,6 +289,12 @@ read the man page virt-v2v(1).
> let input_conn = !input_conn in
> let input_format = !input_format in
> let input_mode = !input_mode in
> + let input_transport =
> + match !input_transport with
> + | None -> None
> + | Some "vddk" -> Some `VDDK
> + | Some transport ->
> + error (f_"unknown input transport ‘-it %s’") transport in
Another option could be to switch from a polymorphic variant to a
simple type, e.g.:
type input_transport =
| None
| VDDK of vddk_options
| SSH
So it will remove the extra vddk_options parameters in most functions
where input_transport is passed, and easily support more options for
future transports.
Ah, but that wouldn't let us restrict the type when it is passed
through to the individual input modes :-)
val input_vmx : [`SSH] option -> string -> Types.input
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW