Blame SOURCES/0009-v2v-Add-general-mechanism-for-input-and-output-optio.patch

df3bb2
From 5198d704e964fa896773d250624858e865c30082 Mon Sep 17 00:00:00 2001
df3bb2
From: "Richard W.M. Jones" <rjones@redhat.com>
df3bb2
Date: Thu, 22 Mar 2018 10:29:23 +0000
df3bb2
Subject: [PATCH] v2v: Add general mechanism for input and output options
df3bb2
 (-io/-oo).
df3bb2
df3bb2
Currently we have a bunch of ad hoc options like --vddk* and --vdsm*
df3bb2
(and proposed to add --rhv*) to handle extra parameters for input and
df3bb2
output modes/transports.  This complicates the command line parsing
df3bb2
and also the clarity of the command line (becauseit's not very obvious
df3bb2
which options apply to which side of the conversion).
df3bb2
df3bb2
Replace these with a general mechanism for handling input and output
df3bb2
options.
df3bb2
df3bb2
Thus (for example):
df3bb2
df3bb2
  --vddk-thumbprint=...   becomes   -io vddk-thumbprint=...
df3bb2
  --vdsm-compat=0.10                -oo vdsm-compat=0.10
df3bb2
df3bb2
The responsibility for parsing input and output options moves into the
df3bb2
input and output drivers.
df3bb2
df3bb2
This improves error checking so it's harder now for wrong flags to be
df3bb2
included on the command line when they don't apply to the current mode.
df3bb2
df3bb2
The old option names are preserved for compatibility.
df3bb2
df3bb2
(cherry picked from commit 6327e716cdd2f161bc639733f216a3a29d26ad3c)
df3bb2
---
df3bb2
 v2v/Makefile.am                  |   4 +
df3bb2
 v2v/cmdline.ml                   | 229 ++++++++++++++-------------
df3bb2
 v2v/input_libvirt.ml             |   4 +-
df3bb2
 v2v/input_libvirt.mli            |   4 +-
df3bb2
 v2v/input_libvirt_vddk.ml        | 112 +++++++++-----
df3bb2
 v2v/input_libvirt_vddk.mli       |  16 +-
df3bb2
 v2v/output_vdsm.ml               |  79 +++++++++-
df3bb2
 v2v/output_vdsm.mli              |  13 +-
df3bb2
 v2v/test-v2v-docs.sh             |  31 +++-
df3bb2
 v2v/test-v2v-it-vddk-io-query.sh |  38 +++++
df3bb2
 v2v/test-v2v-o-vdsm-oo-query.sh  |  38 +++++
df3bb2
 v2v/test-v2v-o-vdsm-options.sh   |  16 +-
df3bb2
 v2v/virt-v2v.pod                 | 258 ++++++++++++++++---------------
df3bb2
 13 files changed, 530 insertions(+), 312 deletions(-)
df3bb2
 create mode 100755 v2v/test-v2v-it-vddk-io-query.sh
df3bb2
 create mode 100755 v2v/test-v2v-o-vdsm-oo-query.sh
df3bb2
df3bb2
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
df3bb2
index 0c3224b24..482ba58e5 100644
df3bb2
--- a/v2v/Makefile.am
df3bb2
+++ b/v2v/Makefile.am
df3bb2
@@ -307,6 +307,8 @@ TESTS = \
df3bb2
 	test-v2v-i-ova-tar.sh \
df3bb2
 	test-v2v-i-ova-two-disks.sh \
df3bb2
 	test-v2v-i-vmx.sh \
df3bb2
+	test-v2v-it-vddk-io-query.sh \
df3bb2
+	test-v2v-o-vdsm-oo-query.sh \
df3bb2
 	test-v2v-bad-networks-and-bridges.sh
df3bb2
 
df3bb2
 if HAVE_LIBVIRT
df3bb2
@@ -470,6 +472,7 @@ EXTRA_DIST += \
df3bb2
 	test-v2v-i-vmx-4.vmx \
df3bb2
 	test-v2v-i-vmx-5.vmx \
df3bb2
 	test-v2v-in-place.sh \
df3bb2
+	test-v2v-it-vddk-io-query.sh \
df3bb2
 	test-v2v-machine-readable.sh \
df3bb2
 	test-v2v-networks-and-bridges-expected.xml \
df3bb2
 	test-v2v-networks-and-bridges.sh \
df3bb2
@@ -480,6 +483,7 @@ EXTRA_DIST += \
df3bb2
 	test-v2v-o-null.sh \
df3bb2
 	test-v2v-o-qemu.sh \
df3bb2
 	test-v2v-o-rhv.sh \
df3bb2
+	test-v2v-o-vdsm-oo-query.sh \
df3bb2
 	test-v2v-o-vdsm-options.sh \
df3bb2
 	test-v2v-oa-option.sh \
df3bb2
 	test-v2v-of-option.sh \
df3bb2
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
df3bb2
index a83fcbae0..5b8f686a8 100644
df3bb2
--- a/v2v/cmdline.ml
df3bb2
+++ b/v2v/cmdline.ml
df3bb2
@@ -65,24 +65,6 @@ let parse_cmdline () =
df3bb2
   let output_password = ref None in
df3bb2
   let output_storage = ref None in
df3bb2
   let password_file = ref None in
df3bb2
-  let vddk_config = ref None in
df3bb2
-  let vddk_cookie = ref None in
df3bb2
-  let vddk_libdir = ref None in
df3bb2
-  let vddk_nfchostport = ref None in
df3bb2
-  let vddk_port = ref None in
df3bb2
-  let vddk_snapshot = ref None in
df3bb2
-  let vddk_thumbprint = ref None in
df3bb2
-  let vddk_transports = ref None in
df3bb2
-  let vddk_vimapiver = ref None in
df3bb2
-  let vdsm_vm_uuid = ref None in
df3bb2
-  let vdsm_ovf_output = ref None in (* default "." *)
df3bb2
-
df3bb2
-  let vdsm_compat = ref "0.10" in
df3bb2
-  let set_vdsm_compat s = vdsm_compat := s in
df3bb2
-
df3bb2
-  let vdsm_ovf_flavour = ref Create_ovf.RHVExportStorageDomain in
df3bb2
-  let set_vdsm_ovf_flavour arg =
df3bb2
-    vdsm_ovf_flavour := Create_ovf.ovf_flavour_of_string arg in
df3bb2
 
df3bb2
   let set_string_option_once optname optref arg =
df3bb2
     match !optref with
df3bb2
@@ -106,6 +88,15 @@ let parse_cmdline () =
df3bb2
       error (f_"unknown -i option: %s") s
df3bb2
   in
df3bb2
 
df3bb2
+  let input_options = ref [] in
df3bb2
+  let set_input_option_compat k v =
df3bb2
+    input_options := (k, v) :: !input_options
df3bb2
+  in
df3bb2
+  let set_input_option option =
df3bb2
+    let k, v = String.split "=" option in
df3bb2
+    set_input_option_compat k v
df3bb2
+  in
df3bb2
+
df3bb2
   let network_map = ref NetworkMap.empty in
df3bb2
   let add_network, add_bridge =
df3bb2
     let add flag name t str =
df3bb2
@@ -159,6 +150,15 @@ let parse_cmdline () =
df3bb2
       error (f_"unknown -oa option: %s") s
df3bb2
   in
df3bb2
 
df3bb2
+  let output_options = ref [] in
df3bb2
+  let set_output_option_compat k v =
df3bb2
+    output_options := (k, v) :: !output_options
df3bb2
+  in
df3bb2
+  let set_output_option option =
df3bb2
+    let k, v = String.split "=" option in
df3bb2
+    set_output_option_compat k v
df3bb2
+  in
df3bb2
+
df3bb2
   let root_choice = ref AskRoot in
df3bb2
   let set_root_choice = function
df3bb2
     | "ask" -> root_choice := AskRoot
df3bb2
@@ -169,12 +169,6 @@ let parse_cmdline () =
df3bb2
       error (f_"unknown --root option: %s") s
df3bb2
   in
df3bb2
 
df3bb2
-  let vdsm_image_uuids = ref [] in
df3bb2
-  let add_vdsm_image_uuid s = List.push_front s vdsm_image_uuids in
df3bb2
-
df3bb2
-  let vdsm_vol_uuids = ref [] in
df3bb2
-  let add_vdsm_vol_uuid s = List.push_front s vdsm_vol_uuids in
df3bb2
-
df3bb2
   let vmtype_warning _ =
df3bb2
     warning (f_"the --vmtype option has been removed and now does nothing")
df3bb2
   in
df3bb2
@@ -198,6 +192,8 @@ let parse_cmdline () =
df3bb2
                                     s_"Libvirt URI";
df3bb2
     [ M"if" ],       Getopt.String ("format", set_string_option_once "-if" input_format),
df3bb2
                                     s_"Input format (for -i disk)";
df3bb2
+    [ M"io" ],       Getopt.String ("option[=value]", set_input_option),
df3bb2
+                                    s_"Set option for input mode";
df3bb2
     [ M"it" ],       Getopt.String ("transport", set_string_option_once "-it" input_transport),
df3bb2
                                     s_"Input transport";
df3bb2
     [ L"in-place" ], Getopt.Set in_place,
df3bb2
@@ -220,6 +216,8 @@ let parse_cmdline () =
df3bb2
                                     s_"Set output format";
df3bb2
     [ M"on" ],       Getopt.String ("name", set_string_option_once "-on" output_name),
df3bb2
                                     s_"Rename guest when converting";
df3bb2
+    [ M"oo" ],       Getopt.String ("option[=value]", set_output_option),
df3bb2
+                                    s_"Set option for output mode";
df3bb2
     [ M"op" ],       Getopt.String ("filename", set_string_option_once "-op" output_password),
df3bb2
                                     s_"Use password from file to connect to output hypervisor";
df3bb2
     [ M"os" ],       Getopt.String ("storage", set_string_option_once "-os" output_storage),
df3bb2
@@ -231,36 +229,36 @@ let parse_cmdline () =
df3bb2
     [ L"qemu-boot" ], Getopt.Set qemu_boot, s_"Boot in qemu (-o qemu only)";
df3bb2
     [ L"root" ],     Getopt.String ("ask|... ", set_root_choice),
df3bb2
                                     s_"How to choose root filesystem";
df3bb2
-    [ L"vddk-config" ], Getopt.String ("filename", set_string_option_once "--vddk-config" vddk_config),
df3bb2
-                                    s_"Set VDDK config file";
df3bb2
-    [ L"vddk-cookie" ], Getopt.String ("cookie", set_string_option_once "--vddk-cookie" vddk_cookie),
df3bb2
-                                    s_"Set VDDK cookie";
df3bb2
-    [ L"vddk-libdir" ], Getopt.String ("libdir", set_string_option_once "--vddk-libdir" vddk_libdir),
df3bb2
-                                    s_"Set VDDK library parent directory";
df3bb2
-    [ L"vddk-nfchostport" ], Getopt.String ("nfchostport", set_string_option_once "--vddk-nfchostport" vddk_nfchostport),
df3bb2
-                                    s_"Set VDDK nfchostport";
df3bb2
-    [ L"vddk-port" ], Getopt.String ("port", set_string_option_once "--vddk-port" vddk_port),
df3bb2
-                                    s_"Set VDDK port";
df3bb2
-    [ L"vddk-snapshot" ], Getopt.String ("snapshot-moref", set_string_option_once "--vddk-snapshot" vddk_snapshot),
df3bb2
-                                    s_"Set VDDK snapshot";
df3bb2
-    [ L"vddk-thumbprint" ], Getopt.String ("thumbprint", set_string_option_once "--vddk-thumbprint" vddk_thumbprint),
df3bb2
-                                    s_"Set VDDK thumbprint";
df3bb2
-    [ L"vddk-transports" ], Getopt.String ("transports", set_string_option_once "--vddk-transports" vddk_transports),
df3bb2
-                                    s_"Set VDDK transports";
df3bb2
-    [ L"vddk-vimapiver" ], Getopt.String ("apiver", set_string_option_once "--vddk-vimapiver" vddk_vimapiver),
df3bb2
-                                    s_"Set VDDK vimapiver";
df3bb2
-    [ L"vdsm-compat" ], Getopt.Symbol ("0.10|1.1", ["0.10"; "1.1"], set_vdsm_compat),
df3bb2
-                                    s_"Write qcow2 with compat=0.10|1.1";
df3bb2
-    [ L"vdsm-image-uuid" ], Getopt.String ("uuid", add_vdsm_image_uuid),
df3bb2
-                                    s_"Output image UUID(s)";
df3bb2
-    [ L"vdsm-vol-uuid" ], Getopt.String ("uuid", add_vdsm_vol_uuid),
df3bb2
-                                    s_"Output vol UUID(s)";
df3bb2
-    [ L"vdsm-vm-uuid" ], Getopt.String ("uuid", set_string_option_once "--vdsm-vm-uuid" vdsm_vm_uuid),
df3bb2
-                                    s_"Output VM UUID";
df3bb2
-    [ L"vdsm-ovf-output" ], Getopt.String ("-", set_string_option_once "--vdsm-ovf-output" vdsm_ovf_output),
df3bb2
-                                    s_"Output OVF file";
df3bb2
-    [ L"vdsm-ovf-flavour" ], Getopt.Symbol (ovf_flavours_str, Create_ovf.ovf_flavours, set_vdsm_ovf_flavour),
df3bb2
-                                    s_"Set the type of generated OVF (default rhvexp)";
df3bb2
+    [ L"vddk-config" ], Getopt.String ("filename", set_input_option_compat "vddk-config"),
df3bb2
+                                    s_"Same as ‘-io vddk-config=filename’";
df3bb2
+    [ L"vddk-cookie" ], Getopt.String ("cookie", set_input_option_compat "vddk-cookie"),
df3bb2
+                                    s_"Same as ‘-io vddk-cookie=filename’";
df3bb2
+    [ L"vddk-libdir" ], Getopt.String ("libdir", set_input_option_compat "vddk-libdir"),
df3bb2
+                                    s_"Same as ‘-io vddk-libdir=libdir’";
df3bb2
+    [ L"vddk-nfchostport" ], Getopt.String ("nfchostport", set_input_option_compat "vddk-nfchostport"),
df3bb2
+                                    s_"Same as ‘-io vddk-nfchostport=nfchostport’";
df3bb2
+    [ L"vddk-port" ], Getopt.String ("port", set_input_option_compat "vddk-port"),
df3bb2
+                                    s_"Same as ‘-io vddk-port=port’";
df3bb2
+    [ L"vddk-snapshot" ], Getopt.String ("snapshot-moref", set_input_option_compat "vddk-snapshot"),
df3bb2
+                                    s_"Same as ‘-io vddk-snapshot=snapshot-moref’";
df3bb2
+    [ L"vddk-thumbprint" ], Getopt.String ("thumbprint", set_input_option_compat "vddk-thumbprint"),
df3bb2
+                                    s_"Same as ‘-io vddk-thumbprint=thumbprint’";
df3bb2
+    [ L"vddk-transports" ], Getopt.String ("transports", set_input_option_compat "vddk-transports"),
df3bb2
+                                    s_"Same as ‘-io vddk-transports=transports’";
df3bb2
+    [ L"vddk-vimapiver" ], Getopt.String ("apiver", set_input_option_compat "vddk-vimapiver"),
df3bb2
+                                    s_"Same as ‘-io vddk-vimapiver=apiver’";
df3bb2
+    [ L"vdsm-compat" ], Getopt.String ("0.10|1.1", set_output_option_compat "vdsm-compat"),
df3bb2
+                                    s_"Same as ‘-oo vdsm-compat=0.10|1.1’";
df3bb2
+    [ L"vdsm-image-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-image-uuid"),
df3bb2
+                                    s_"Same as ‘-oo vdsm-image-uuid=uuid’";
df3bb2
+    [ L"vdsm-vol-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vol-uuid"),
df3bb2
+                                    s_"Same as ‘-oo vdsm-vol-uuid=uuid’";
df3bb2
+    [ L"vdsm-vm-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vm-uuid"),
df3bb2
+                                    s_"Same as ‘-oo vdsm-vm-uuid=uuid’";
df3bb2
+    [ L"vdsm-ovf-output" ], Getopt.String ("dir", set_output_option_compat "vdsm-ovf-output"),
df3bb2
+                                    s_"Same as ‘-oo vdsm-ovf-output=dir’";
df3bb2
+    [ L"vdsm-ovf-flavour" ], Getopt.String (ovf_flavours_str, set_output_option_compat "vdsm-ovf-flavour"),
df3bb2
+                                    s_"Same as ‘-oo vdsm-ovf-flavour=flavour’";
df3bb2
     [ L"vmtype" ],   Getopt.String ("-", vmtype_warning),
df3bb2
                                     s_"Ignored for backwards compatibility";
df3bb2
   ] in
df3bb2
@@ -299,6 +297,7 @@ read the man page virt-v2v(1).
df3bb2
   let input_conn = !input_conn in
df3bb2
   let input_format = !input_format in
df3bb2
   let input_mode = !input_mode in
df3bb2
+  let input_options = List.rev !input_options in
df3bb2
   let input_transport =
df3bb2
     match !input_transport with
df3bb2
     | None -> None
df3bb2
@@ -317,28 +316,13 @@ read the man page virt-v2v(1).
df3bb2
   let output_format = !output_format in
df3bb2
   let output_mode = !output_mode in
df3bb2
   let output_name = !output_name in
df3bb2
+  let output_options = List.rev !output_options in
df3bb2
   let output_password = !output_password in
df3bb2
   let output_storage = !output_storage in
df3bb2
   let password_file = !password_file in
df3bb2
   let print_source = !print_source in
df3bb2
   let qemu_boot = !qemu_boot in
df3bb2
   let root_choice = !root_choice in
df3bb2
-  let vddk_options =
df3bb2
-      { Input_libvirt_vddk.vddk_config = !vddk_config;
df3bb2
-        vddk_cookie = !vddk_cookie;
df3bb2
-        vddk_libdir = !vddk_libdir;
df3bb2
-        vddk_nfchostport = !vddk_nfchostport;
df3bb2
-        vddk_port = !vddk_port;
df3bb2
-        vddk_snapshot = !vddk_snapshot;
df3bb2
-        vddk_thumbprint = !vddk_thumbprint;
df3bb2
-        vddk_transports = !vddk_transports;
df3bb2
-        vddk_vimapiver = !vddk_vimapiver } in
df3bb2
-  let vdsm_compat = !vdsm_compat in
df3bb2
-  let vdsm_image_uuids = List.rev !vdsm_image_uuids in
df3bb2
-  let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
df3bb2
-  let vdsm_vm_uuid = !vdsm_vm_uuid in
df3bb2
-  let vdsm_ovf_output = Option.default "." !vdsm_ovf_output in
df3bb2
-  let vdsm_ovf_flavour = !vdsm_ovf_flavour in
df3bb2
 
df3bb2
   (* No arguments and machine-readable mode?  Print out some facts
df3bb2
    * about what this binary supports.
df3bb2
@@ -352,6 +336,7 @@ read the man page virt-v2v(1).
df3bb2
     printf "colours-option\n";
df3bb2
     printf "vdsm-compat-option\n";
df3bb2
     printf "in-place\n";
df3bb2
+    printf "io/oo\n";
df3bb2
     List.iter (printf "input:%s\n") (Modules_list.input_modules ());
df3bb2
     List.iter (printf "output:%s\n") (Modules_list.output_modules ());
df3bb2
     List.iter (printf "convert:%s\n") (Modules_list.convert_modules ());
df3bb2
@@ -359,6 +344,65 @@ read the man page virt-v2v(1).
df3bb2
     exit 0
df3bb2
   );
df3bb2
 
df3bb2
+  (* Input transport affects whether some input options should or
df3bb2
+   * should not be used.
df3bb2
+   *)
df3bb2
+  let input_transport =
df3bb2
+    let is_query = input_options = ["?", ""] in
df3bb2
+    let no_options () =
df3bb2
+      if is_query then (
df3bb2
+        printf (f_"No -io (input options) are supported with this input transport.\n");
df3bb2
+        exit 0
df3bb2
+      )
df3bb2
+      else if input_options <> [] then
df3bb2
+        error (f_"no -io (input options) are allowed here");
df3bb2
+    in
df3bb2
+    match input_transport with
df3bb2
+    | None -> no_options (); None
df3bb2
+    | Some `SSH -> no_options (); Some `SSH
df3bb2
+    | Some `VDDK ->
df3bb2
+       if is_query then (
df3bb2
+         Input_libvirt_vddk.print_input_options ();
df3bb2
+         exit 0
df3bb2
+       )
df3bb2
+       else (
df3bb2
+         let vddk_options =
df3bb2
+           Input_libvirt_vddk.parse_input_options input_options in
df3bb2
+         Some (`VDDK vddk_options)
df3bb2
+       ) in
df3bb2
+
df3bb2
+  (* Output mode affects whether some output options should or
df3bb2
+   * should not be used.
df3bb2
+   *)
df3bb2
+  let output_mode =
df3bb2
+    let is_query = output_options = ["?", ""] in
df3bb2
+    let no_options () =
df3bb2
+      if is_query then (
df3bb2
+        printf (f_"No -oo (output options) are supported in this output mode.\n");
df3bb2
+        exit 0
df3bb2
+      )
df3bb2
+      else if output_options <> [] then
df3bb2
+        error (f_"no -oo (output options) are allowed here");
df3bb2
+    in
df3bb2
+    match output_mode with
df3bb2
+    | `Not_set -> no_options (); `Not_set
df3bb2
+    | `Glance -> no_options (); `Glance
df3bb2
+    | `Libvirt -> no_options (); `Libvirt
df3bb2
+    | `Local -> no_options (); `Local
df3bb2
+    | `Null -> no_options (); `Null
df3bb2
+    | `RHV -> no_options (); `RHV
df3bb2
+    | `QEmu -> no_options (); `QEmu
df3bb2
+    | `VDSM ->
df3bb2
+       if is_query then (
df3bb2
+         Output_vdsm.print_output_options ();
df3bb2
+         exit 0
df3bb2
+       )
df3bb2
+       else (
df3bb2
+         let vdsm_options =
df3bb2
+           Output_vdsm.parse_output_options output_options in
df3bb2
+         `VDSM vdsm_options
df3bb2
+       ) in
df3bb2
+
df3bb2
   (* Parse out the password from the password file. *)
df3bb2
   let password =
df3bb2
     match password_file with
df3bb2
@@ -367,27 +411,6 @@ read the man page virt-v2v(1).
df3bb2
       let password = read_first_line_from_file filename in
df3bb2
       Some password in
df3bb2
 
df3bb2
-  (* Input transport affects whether some parameters should or
df3bb2
-   * should not be used.
df3bb2
-   *)
df3bb2
-  (match input_transport with
df3bb2
-   | None
df3bb2
-   | Some `SSH ->
df3bb2
-      if !vddk_config <> None ||
df3bb2
-         !vddk_cookie <> None ||
df3bb2
-         !vddk_libdir <> None ||
df3bb2
-         !vddk_nfchostport <> None ||
df3bb2
-         !vddk_port <> None ||
df3bb2
-         !vddk_snapshot <> None ||
df3bb2
-         !vddk_thumbprint <> None ||
df3bb2
-         !vddk_transports <> None ||
df3bb2
-         !vddk_vimapiver <> None then
df3bb2
-        error (f_"‘--vddk-*’ options should only be used when conversion via the nbdkit VDDK plugin has been enabled, ie. using ‘-it vddk’.")
df3bb2
-   | Some `VDDK ->
df3bb2
-      if !vddk_thumbprint = None then
df3bb2
-        error (f_"‘--vddk-thumbprint’ is required when using ‘-it vddk’.")
df3bb2
-  );
df3bb2
-
df3bb2
   (* Parsing of the argument(s) depends on the input mode. *)
df3bb2
   let input =
df3bb2
     match input_mode with
df3bb2
@@ -413,11 +436,10 @@ read the man page virt-v2v(1).
df3bb2
       let input_transport =
df3bb2
         match input_transport with
df3bb2
         | None -> None
df3bb2
-        | Some `VDDK -> Some `VDDK
df3bb2
+        | (Some (`VDDK _) as vddk) -> vddk
df3bb2
         | Some `SSH ->
df3bb2
            error (f_"only ‘-it vddk’ can be used here") in
df3bb2
-      Input_libvirt.input_libvirt vddk_options password
df3bb2
-                                  input_conn input_transport guest
df3bb2
+      Input_libvirt.input_libvirt password input_conn input_transport guest
df3bb2
 
df3bb2
     | `LibvirtXML ->
df3bb2
       (* -i libvirtxml: Expecting a filename (XML file). *)
df3bb2
@@ -448,7 +470,7 @@ read the man page virt-v2v(1).
df3bb2
         match input_transport with
df3bb2
         | None -> None
df3bb2
         | Some `SSH -> Some `SSH
df3bb2
-        | Some `VDDK ->
df3bb2
+        | Some (`VDDK _) ->
df3bb2
            error (f_"only ‘-it ssh’ can be used here") in
df3bb2
       Input_vmx.input_vmx input_transport arg in
df3bb2
 
df3bb2
@@ -546,7 +568,7 @@ read the man page virt-v2v(1).
df3bb2
       Output_rhv.output_rhv os output_alloc,
df3bb2
       output_format, output_alloc
df3bb2
 
df3bb2
-    | `VDSM ->
df3bb2
+    | `VDSM vdsm_options ->
df3bb2
       if output_password <> None then
df3bb2
         error_option_cannot_be_used_in_output_mode "vdsm" "-op";
df3bb2
       let os =
df3bb2
@@ -556,21 +578,6 @@ read the man page virt-v2v(1).
df3bb2
         | Some d -> d in
df3bb2
       if qemu_boot then
df3bb2
         error_option_cannot_be_used_in_output_mode "vdsm" "--qemu-boot";
df3bb2
-      let vdsm_vm_uuid =
df3bb2
-        match vdsm_vm_uuid with
df3bb2
-        | None ->
df3bb2
-           error (f_"-o vdsm: --vdsm-image-uuid was not specified")
df3bb2
-        | Some s -> s in
df3bb2
-      if vdsm_image_uuids = [] || vdsm_vol_uuids = [] then
df3bb2
-        error (f_"-o vdsm: either --vdsm-vol-uuid or --vdsm-vm-uuid was not specified");
df3bb2
-      let vdsm_options = {
df3bb2
-        Output_vdsm.image_uuids = vdsm_image_uuids;
df3bb2
-        vol_uuids = vdsm_vol_uuids;
df3bb2
-        vm_uuid = vdsm_vm_uuid;
df3bb2
-        ovf_output = vdsm_ovf_output;
df3bb2
-        compat = vdsm_compat;
df3bb2
-        ovf_flavour = vdsm_ovf_flavour;
df3bb2
-      } in
df3bb2
       Output_vdsm.output_vdsm os vdsm_options output_alloc,
df3bb2
       output_format, output_alloc in
df3bb2
 
df3bb2
diff --git a/v2v/input_libvirt.ml b/v2v/input_libvirt.ml
df3bb2
index 25c81b924..377257dc2 100644
df3bb2
--- a/v2v/input_libvirt.ml
df3bb2
+++ b/v2v/input_libvirt.ml
df3bb2
@@ -27,7 +27,7 @@ open Types
df3bb2
 open Utils
df3bb2
 
df3bb2
 (* Choose the right subclass based on the URI. *)
df3bb2
-let input_libvirt vddk_options password libvirt_uri input_transport guest =
df3bb2
+let input_libvirt password libvirt_uri input_transport guest =
df3bb2
   match libvirt_uri with
df3bb2
   | None ->
df3bb2
     Input_libvirt_other.input_libvirt_other password libvirt_uri guest
df3bb2
@@ -53,7 +53,7 @@ let input_libvirt vddk_options password libvirt_uri input_transport guest =
df3bb2
          password libvirt_uri parsed_uri server guest
df3bb2
 
df3bb2
     (* vCenter or ESXi using nbdkit vddk plugin *)
df3bb2
-    | Some server, Some ("esx"|"gsx"|"vpx"), Some `VDDK ->
df3bb2
+    | Some server, Some ("esx"|"gsx"|"vpx"), Some (`VDDK vddk_options) ->
df3bb2
        Input_libvirt_vddk.input_libvirt_vddk vddk_options password
df3bb2
                                              libvirt_uri parsed_uri guest
df3bb2
 
df3bb2
diff --git a/v2v/input_libvirt.mli b/v2v/input_libvirt.mli
df3bb2
index 6f9162482..08824bb67 100644
df3bb2
--- a/v2v/input_libvirt.mli
df3bb2
+++ b/v2v/input_libvirt.mli
df3bb2
@@ -18,7 +18,7 @@
df3bb2
 
df3bb2
 (** [-i libvirt] source. *)
df3bb2
 
df3bb2
-val input_libvirt : Input_libvirt_vddk.vddk_options -> string option -> string option -> [`VDDK] option -> string -> Types.input
df3bb2
-(** [input_libvirt vddk_options password libvirt_uri input_transport guest]
df3bb2
+val input_libvirt : string option -> string option -> [`VDDK of Input_libvirt_vddk.vddk_options] option -> string -> Types.input
df3bb2
+(** [input_libvirt password libvirt_uri input_transport guest]
df3bb2
     creates and returns a new {!Types.input} object specialized for reading
df3bb2
     input from libvirt sources. *)
df3bb2
diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml
df3bb2
index a53f3e71d..0b3ed7af9 100644
df3bb2
--- a/v2v/input_libvirt_vddk.ml
df3bb2
+++ b/v2v/input_libvirt_vddk.ml
df3bb2
@@ -33,22 +33,73 @@ open Xpath_helpers
df3bb2
 
df3bb2
 open Printf
df3bb2
 
df3bb2
-type vddk_options = {
df3bb2
-    vddk_config : string option;
df3bb2
-    vddk_cookie : string option;
df3bb2
-    vddk_libdir : string option;
df3bb2
-    vddk_nfchostport : string option;
df3bb2
-    vddk_port : string option;
df3bb2
-    vddk_snapshot : string option;
df3bb2
-    vddk_thumbprint : string option;
df3bb2
-    vddk_transports : string option;
df3bb2
-    vddk_vimapiver : string option;
df3bb2
-}
df3bb2
+type vddk_options = (string * string) list
df3bb2
+
df3bb2
+(* List of vddk-* input options. *)
df3bb2
+let vddk_option_keys =
df3bb2
+  [ "config";
df3bb2
+    "cookie";
df3bb2
+    "libdir";
df3bb2
+    "nfchostport";
df3bb2
+    "port";
df3bb2
+    "snapshot";
df3bb2
+    "thumbprint";
df3bb2
+    "transports";
df3bb2
+    "vimapiver" ]
df3bb2
+
df3bb2
+let print_input_options () =
df3bb2
+  printf (f_"Input options (-io) which can be used with -it vddk:
df3bb2
+
df3bb2
+  -io vddk-thumbprint=xx:xx:xx:...
df3bb2
+                               VDDK server thumbprint (required)
df3bb2
+
df3bb2
+All other settings are optional:
df3bb2
+
df3bb2
+  -io vddk-config=FILE         VDDK configuration file
df3bb2
+  -io vddk-cookie=COOKIE       VDDK cookie
df3bb2
+  -io vddk-libdir=LIBDIR       VDDK library parent directory
df3bb2
+  -io vddk-nfchostport=PORT    VDDK nfchostport
df3bb2
+  -io vddk-port=PORT           VDDK port
df3bb2
+  -io vddk-snapshot=SNAPSHOT-MOREF
df3bb2
+                               VDDK snapshot moref
df3bb2
+  -io vddk-transports=MODE:MODE:..
df3bb2
+                               VDDK transports
df3bb2
+  -io vddk-vimapiver=APIVER    VDDK vimapiver
df3bb2
+
df3bb2
+Refer to nbdkit-vddk-plugin(1) and the VDDK documentation for further
df3bb2
+information on these settings.
df3bb2
+")
df3bb2
+
df3bb2
+let parse_input_options options =
df3bb2
+  (* Check there are no options we don't understand.  Also removes
df3bb2
+   * the "vddk-" prefix from the internal list.
df3bb2
+   *)
df3bb2
+  let options =
df3bb2
+    List.map (
df3bb2
+      fun (key, value) ->
df3bb2
+        let error_invalid_key () =
df3bb2
+          error (f_"-it vddk: ‘-io %s’ is not a valid input option") key
df3bb2
+        in
df3bb2
+        if not (String.is_prefix key "vddk-") then error_invalid_key ();
df3bb2
+        let key = String.sub key 5 (String.length key-5) in
df3bb2
+        if not (List.mem key vddk_option_keys) then error_invalid_key ();
df3bb2
+
df3bb2
+        (key, value)
df3bb2
+    ) options in
df3bb2
+
df3bb2
+  (* Check no option appears twice. *)
df3bb2
+  let keys = List.map fst options in
df3bb2
+  if List.length keys <> List.length (List.sort_uniq keys) then
df3bb2
+    error (f_"-it vddk: duplicate -io options on the command line");
df3bb2
+
df3bb2
+  options
df3bb2
 
df3bb2
 (* Subclass specialized for handling VMware via nbdkit vddk plugin. *)
df3bb2
 class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest =
df3bb2
   (* The VDDK path. *)
df3bb2
-  let libdir = vddk_options.vddk_libdir in
df3bb2
+  let libdir =
df3bb2
+    try Some (List.assoc "libdir" vddk_options)
df3bb2
+    with Not_found -> None in
df3bb2
 
df3bb2
   (* VDDK libraries are located under lib32/ or lib64/ relative to the
df3bb2
    * libdir.  Note this is unrelated to Linux multilib or multiarch.
df3bb2
@@ -68,7 +119,7 @@ class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest =
df3bb2
      | None -> ()
df3bb2
      | Some libdir ->
df3bb2
         if not (is_directory libdir) then
df3bb2
-          error (f_"‘--vddk-libdir %s’ does not point to a directory.  See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libdir
df3bb2
+          error (f_"‘-io vddk-libdir=%s’ does not point to a directory.  See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libdir
df3bb2
     );
df3bb2
 
df3bb2
     (match library_path with
df3bb2
@@ -122,15 +173,15 @@ See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.")
df3bb2
       else
df3bb2
         error (f_"nbdkit VDDK plugin is not installed or not working.  It is required if you want to use VDDK.
df3bb2
 
df3bb2
-It looks like you did not set the right path in the ‘--vddk-libdir’ option, or your copy of the VDDK directory is incomplete.  There should be a library called ’<libdir>/%s/libvixDiskLib.so.?’.
df3bb2
+It looks like you did not set the right path in the ‘-io vddk-libdir’ option, or your copy of the VDDK directory is incomplete.  There should be a library called ’<libdir>/%s/libvixDiskLib.so.?’.
df3bb2
 
df3bb2
 See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libNN
df3bb2
     )
df3bb2
   in
df3bb2
 
df3bb2
   let error_unless_thumbprint () =
df3bb2
-    if vddk_options.vddk_thumbprint = None then
df3bb2
-      error (f_"You must pass the ‘--vddk-thumbprint’ option with the SSL thumbprint of the VMware server.  To find the thumbprint, see the nbdkit-vddk-plugin(1) manual.  See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.")
df3bb2
+    if not (List.mem_assoc "thumbprint" vddk_options) then
df3bb2
+      error (f_"You must pass the ‘-io vddk-thumbprint’ option with the SSL thumbprint of the VMware server.  To find the thumbprint, see the nbdkit-vddk-plugin(1) manual.  See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.")
df3bb2
   in
df3bb2
 
df3bb2
   (* Check that nbdkit was compiled with SELinux support (for the
df3bb2
@@ -147,18 +198,6 @@ See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libNN
df3bb2
       error (f_"nbdkit was compiled without SELinux support.  You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.")
df3bb2
   in
df3bb2
 
df3bb2
-  (* List of passthrough parameters. *)
df3bb2
-  let vddk_passthrus =
df3bb2
-    [ "config",      (fun { vddk_config }      -> vddk_config);
df3bb2
-      "cookie",      (fun { vddk_cookie }      -> vddk_cookie);
df3bb2
-      "libdir",      (fun { vddk_libdir }      -> vddk_libdir);
df3bb2
-      "nfchostport", (fun { vddk_nfchostport } -> vddk_nfchostport);
df3bb2
-      "port",        (fun { vddk_port }        -> vddk_port);
df3bb2
-      "snapshot",    (fun { vddk_snapshot }    -> vddk_snapshot);
df3bb2
-      "thumbprint",  (fun { vddk_thumbprint }  -> vddk_thumbprint);
df3bb2
-      "transports",  (fun { vddk_transports }  -> vddk_transports);
df3bb2
-      "vimapiver",   (fun { vddk_vimapiver }   -> vddk_vimapiver) ] in
df3bb2
-
df3bb2
 object
df3bb2
   inherit input_libvirt password libvirt_uri guest as super
df3bb2
 
df3bb2
@@ -172,14 +211,9 @@ object
df3bb2
 
df3bb2
   method as_options =
df3bb2
     let pt_options =
df3bb2
-      String.concat "" (
df3bb2
-        List.map (
df3bb2
-          fun (name, get_field) ->
df3bb2
-            match get_field vddk_options with
df3bb2
-            | None -> ""
df3bb2
-            | Some field -> sprintf " --vddk-%s %s" name field
df3bb2
-        ) vddk_passthrus
df3bb2
-      ) in
df3bb2
+      String.concat ""
df3bb2
+                    (List.map (fun (k, v) ->
df3bb2
+                         sprintf " -io vddk-%s=%s" k v) vddk_options) in
df3bb2
     sprintf "%s -it vddk %s"
df3bb2
             super#as_options (* superclass prints "-i libvirt etc" *)
df3bb2
             pt_options
df3bb2
@@ -284,11 +318,7 @@ object
df3bb2
       add_arg (sprintf "vm=moref=%s" moref);
df3bb2
 
df3bb2
       (* The passthrough parameters. *)
df3bb2
-      List.iter (
df3bb2
-        fun (name, get_field) ->
df3bb2
-          Option.may (fun field -> add_arg (sprintf "%s=%s" name field))
df3bb2
-                     (get_field vddk_options)
df3bb2
-      ) vddk_passthrus;
df3bb2
+      List.iter (fun (k, v) -> add_arg (sprintf "%s=%s" k v)) vddk_options;
df3bb2
 
df3bb2
       get_args () in
df3bb2
 
df3bb2
diff --git a/v2v/input_libvirt_vddk.mli b/v2v/input_libvirt_vddk.mli
df3bb2
index c8606c72a..1cebba506 100644
df3bb2
--- a/v2v/input_libvirt_vddk.mli
df3bb2
+++ b/v2v/input_libvirt_vddk.mli
df3bb2
@@ -18,19 +18,13 @@
df3bb2
 
df3bb2
 (** [-i libvirt] when the source is VMware via nbdkit vddk plugin *)
df3bb2
 
df3bb2
-type vddk_options = {
df3bb2
-    vddk_config : string option;
df3bb2
-    vddk_cookie : string option;
df3bb2
-    vddk_libdir : string option;
df3bb2
-    vddk_nfchostport : string option;
df3bb2
-    vddk_port : string option;
df3bb2
-    vddk_snapshot : string option;
df3bb2
-    vddk_thumbprint : string option;
df3bb2
-    vddk_transports : string option;
df3bb2
-    vddk_vimapiver : string option;
df3bb2
-}
df3bb2
+type vddk_options
df3bb2
 (** Various options passed through to the nbdkit vddk plugin unmodified. *)
df3bb2
 
df3bb2
+val print_input_options : unit -> unit
df3bb2
+val parse_input_options : (string * string) list -> vddk_options
df3bb2
+(** Print and parse vddk -io options. *)
df3bb2
+
df3bb2
 val input_libvirt_vddk : vddk_options -> string option -> string option -> Xml.uri -> string -> Types.input
df3bb2
 (** [input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest]
df3bb2
     creates and returns a {!Types.input} object specialized for reading
df3bb2
diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
df3bb2
index b76a2e930..92b3fd122 100644
df3bb2
--- a/v2v/output_vdsm.ml
df3bb2
+++ b/v2v/output_vdsm.ml
df3bb2
@@ -35,23 +35,90 @@ type vdsm_options = {
df3bb2
   ovf_flavour : Create_ovf.ovf_flavour;
df3bb2
 }
df3bb2
 
df3bb2
+let ovf_flavours_str = String.concat "|" Create_ovf.ovf_flavours
df3bb2
+
df3bb2
+let print_output_options () =
df3bb2
+  printf (f_"Output options (-oo) which can be used with -o vdsm:
df3bb2
+
df3bb2
+  -oo vdsm-compat=0.10|1.1     Write qcow2 with compat=0.10|1.1
df3bb2
+                                   (default: 0.10)
df3bb2
+  -oo vdsm-vm-uuid=UUID        VM UUID (required)
df3bb2
+  -oo vdsm-ovf-output=DIR      OVF metadata directory (required)
df3bb2
+  -oo vdsm-ovf-flavour=%s
df3bb2
+                               Set the type of generated OVF (default: rhvexp)
df3bb2
+
df3bb2
+For each disk you must supply one of each of these options:
df3bb2
+
df3bb2
+  -oo vdsm-image-uuid=UUID     Image directory UUID
df3bb2
+  -oo vdsm-vol-uuid=UUID       Disk volume UUID
df3bb2
+") ovf_flavours_str
df3bb2
+
df3bb2
+let parse_output_options options =
df3bb2
+  let vm_uuid = ref None in
df3bb2
+  let ovf_output = ref None in (* default "." *)
df3bb2
+  let compat = ref "0.10" in
df3bb2
+  let ovf_flavour = ref Create_ovf.RHVExportStorageDomain in
df3bb2
+  let image_uuids = ref [] in
df3bb2
+  let vol_uuids = ref [] in
df3bb2
+
df3bb2
+  List.iter (
df3bb2
+    function
df3bb2
+    | "vdsm-compat", "0.10" -> compat := "0.10"
df3bb2
+    | "vdsm-compat", "1.1" -> compat := "1.1"
df3bb2
+    | "vdsm-compat", v ->
df3bb2
+       error (f_"-o vdsm: unknown vdsm-compat level ‘%s’") v
df3bb2
+    | "vdsm-vm-uuid", v ->
df3bb2
+       if !vm_uuid <> None then
df3bb2
+         error (f_"-o vdsm: -oo vdsm-vm-uuid set twice");
df3bb2
+       vm_uuid := Some v;
df3bb2
+    | "vdsm-ovf-output", v ->
df3bb2
+       if !ovf_output <> None then
df3bb2
+         error (f_"-o vdsm: -oo vdsm-ovf-output set twice");
df3bb2
+       ovf_output := Some v;
df3bb2
+    | "vdsm-ovf-flavour", v ->
df3bb2
+       ovf_flavour := Create_ovf.ovf_flavour_of_string v
df3bb2
+    | "vdsm-image-uuid", v ->
df3bb2
+       List.push_front v image_uuids
df3bb2
+    | "vdsm-vol-uuid", v ->
df3bb2
+       List.push_front v vol_uuids
df3bb2
+    | k, _ ->
df3bb2
+       error (f_"-o vdsm: unknown output option ‘-oo %s’") k
df3bb2
+  ) options;
df3bb2
+
df3bb2
+  let compat = !compat in
df3bb2
+  let image_uuids = List.rev !image_uuids in
df3bb2
+  let vol_uuids = List.rev !vol_uuids in
df3bb2
+  if image_uuids = [] || vol_uuids = [] then
df3bb2
+    error (f_"-o vdsm: either -oo vdsm-vol-uuid or -oo vdsm-vm-uuid was not specified");
df3bb2
+  let vm_uuid =
df3bb2
+    match !vm_uuid with
df3bb2
+    | None ->
df3bb2
+       error (f_"-o vdsm: -oo vdsm-image-uuid was not specified")
df3bb2
+    | Some uuid -> uuid in
df3bb2
+  let ovf_output = Option.default "." !ovf_output in
df3bb2
+  let ovf_flavour = !ovf_flavour in
df3bb2
+
df3bb2
+  { image_uuids; vol_uuids; vm_uuid; ovf_output; compat; ovf_flavour }
df3bb2
+
df3bb2
 class output_vdsm os vdsm_options output_alloc =
df3bb2
 object
df3bb2
   inherit output
df3bb2
 
df3bb2
   method as_options =
df3bb2
-    sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s%s" os
df3bb2
+    sprintf "-o vdsm -os %s%s%s -oo vdsm-vm-uuid=%s -oo vdsm-ovf-output=%s%s%s" os
df3bb2
       (String.concat ""
df3bb2
-         (List.map (sprintf " --vdsm-image-uuid %s") vdsm_options.image_uuids))
df3bb2
+         (List.map (sprintf " -oo vdsm-image-uuid=%s")
df3bb2
+                   vdsm_options.image_uuids))
df3bb2
       (String.concat ""
df3bb2
-         (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_options.vol_uuids))
df3bb2
+         (List.map (sprintf " -oo vdsm-vol-uuid=%s")
df3bb2
+                   vdsm_options.vol_uuids))
df3bb2
       vdsm_options.vm_uuid
df3bb2
       vdsm_options.ovf_output
df3bb2
       (match vdsm_options.compat with
df3bb2
        | "0.10" -> "" (* currently this is the default, so don't print it *)
df3bb2
-       | s -> sprintf " --vdsm-compat=%s" s)
df3bb2
+       | s -> sprintf " -oo vdsm-compat=%s" s)
df3bb2
       (match vdsm_options.ovf_flavour with
df3bb2
-       | Create_ovf.OVirt -> "--vdsm-ovf-flavour=ovf"
df3bb2
+       | Create_ovf.OVirt -> "-oo vdsm-ovf-flavour=ovf"
df3bb2
        (* currently this is the default, so don't print it *)
df3bb2
        | Create_ovf.RHVExportStorageDomain -> "")
df3bb2
 
df3bb2
@@ -84,7 +151,7 @@ object
df3bb2
   method prepare_targets _ targets =
df3bb2
     if List.length vdsm_options.image_uuids <> List.length targets ||
df3bb2
       List.length vdsm_options.vol_uuids <> List.length targets then
df3bb2
-      error (f_"the number of ‘--vdsm-image-uuid’ and ‘--vdsm-vol-uuid’ parameters passed on the command line has to match the number of guest disk images (for this guest: %d)")
df3bb2
+      error (f_"the number of ‘-oo vdsm-image-uuid’ and ‘-oo vdsm-vol-uuid’ parameters passed on the command line has to match the number of guest disk images (for this guest: %d)")
df3bb2
         (List.length targets);
df3bb2
 
df3bb2
     let mp, uuid =
df3bb2
diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli
df3bb2
index 6ed684638..36f327900 100644
df3bb2
--- a/v2v/output_vdsm.mli
df3bb2
+++ b/v2v/output_vdsm.mli
df3bb2
@@ -18,16 +18,13 @@
df3bb2
 
df3bb2
 (** [-o vdsm] target. *)
df3bb2
 
df3bb2
-type vdsm_options = {
df3bb2
-  image_uuids : string list;          (* --vdsm-image-uuid (multiple) *)
df3bb2
-  vol_uuids : string list;            (* --vdsm-vol-uuid (multiple) *)
df3bb2
-  vm_uuid : string;                   (* --vdsm-vm-uuid *)
df3bb2
-  ovf_output : string;                (* --vdsm-ovf-output *)
df3bb2
-  compat : string;                    (* --vdsm-compat=0.10|1.1 *)
df3bb2
-  ovf_flavour : Create_ovf.ovf_flavour;
df3bb2
-}
df3bb2
+type vdsm_options
df3bb2
 (** Miscellaneous extra command line parameters used by VDSM. *)
df3bb2
 
df3bb2
+val print_output_options : unit -> unit
df3bb2
+val parse_output_options : (string * string) list -> vdsm_options
df3bb2
+(** Print and parse vdsm -oo options. *)
df3bb2
+
df3bb2
 val output_vdsm : string -> vdsm_options -> Types.output_allocation -> Types.output
df3bb2
 (** [output_vdsm os vdsm_options output_alloc] creates and
df3bb2
     returns a new {!Types.output} object specialized for writing
df3bb2
diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh
df3bb2
index 0e3bd916a..e1e22b599 100755
df3bb2
--- a/v2v/test-v2v-docs.sh
df3bb2
+++ b/v2v/test-v2v-docs.sh
df3bb2
@@ -22,4 +22,33 @@ $TEST_FUNCTIONS
df3bb2
 skip_if_skipped
df3bb2
 
df3bb2
 $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
df3bb2
-  --ignore=--debug-overlay,--ic,--if,--it,--no-trim,--oa,--oc,--of,--on,--op,--os,--vmtype
df3bb2
+  --ignore=\
df3bb2
+--debug-overlay,\
df3bb2
+--ic,\
df3bb2
+--if,\
df3bb2
+--io,\
df3bb2
+--it,\
df3bb2
+--no-trim,\
df3bb2
+--oa,\
df3bb2
+--oc,\
df3bb2
+--of,\
df3bb2
+--on,\
df3bb2
+--oo,\
df3bb2
+--op,\
df3bb2
+--os,\
df3bb2
+--vddk-config,\
df3bb2
+--vddk-cookie,\
df3bb2
+--vddk-libdir,\
df3bb2
+--vddk-nfchostport,\
df3bb2
+--vddk-port,\
df3bb2
+--vddk-snapshot,\
df3bb2
+--vddk-thumbprint,\
df3bb2
+--vddk-transports,\
df3bb2
+--vddk-vimapiver,\
df3bb2
+--vdsm-compat,\
df3bb2
+--vdsm-image-uuid,\
df3bb2
+--vdsm-ovf-flavour,\
df3bb2
+--vdsm-ovf-output,\
df3bb2
+--vdsm-vm-uuid,\
df3bb2
+--vdsm-vol-uuid,\
df3bb2
+--vmtype
df3bb2
diff --git a/v2v/test-v2v-it-vddk-io-query.sh b/v2v/test-v2v-it-vddk-io-query.sh
df3bb2
new file mode 100755
df3bb2
index 000000000..014e30207
df3bb2
--- /dev/null
df3bb2
+++ b/v2v/test-v2v-it-vddk-io-query.sh
df3bb2
@@ -0,0 +1,38 @@
df3bb2
+#!/bin/bash -
df3bb2
+# libguestfs virt-v2v test script
df3bb2
+# Copyright (C) 2018 Red Hat Inc.
df3bb2
+#
df3bb2
+# This program is free software; you can redistribute it and/or modify
df3bb2
+# it under the terms of the GNU General Public License as published by
df3bb2
+# the Free Software Foundation; either version 2 of the License, or
df3bb2
+# (at your option) any later version.
df3bb2
+#
df3bb2
+# This program is distributed in the hope that it will be useful,
df3bb2
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
df3bb2
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
df3bb2
+# GNU General Public License for more details.
df3bb2
+#
df3bb2
+# You should have received a copy of the GNU General Public License
df3bb2
+# along with this program; if not, write to the Free Software
df3bb2
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
df3bb2
+
df3bb2
+# Test -io "?" option.
df3bb2
+
df3bb2
+set -e
df3bb2
+
df3bb2
+$TEST_FUNCTIONS
df3bb2
+skip_if_skipped
df3bb2
+
df3bb2
+export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
df3bb2
+export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
df3bb2
+
df3bb2
+f=test-v2v-it-vddk-io-query.actual
df3bb2
+rm -f $f
df3bb2
+
df3bb2
+$VG virt-v2v --debug-gc \
df3bb2
+    -it vddk -io "?" > $f
df3bb2
+
df3bb2
+grep -- "-io vddk-config" $f
df3bb2
+grep -- "-io vddk-thumbprint" $f
df3bb2
+
df3bb2
+rm $f
df3bb2
diff --git a/v2v/test-v2v-o-vdsm-oo-query.sh b/v2v/test-v2v-o-vdsm-oo-query.sh
df3bb2
new file mode 100755
df3bb2
index 000000000..5691446ea
df3bb2
--- /dev/null
df3bb2
+++ b/v2v/test-v2v-o-vdsm-oo-query.sh
df3bb2
@@ -0,0 +1,38 @@
df3bb2
+#!/bin/bash -
df3bb2
+# libguestfs virt-v2v test script
df3bb2
+# Copyright (C) 2018 Red Hat Inc.
df3bb2
+#
df3bb2
+# This program is free software; you can redistribute it and/or modify
df3bb2
+# it under the terms of the GNU General Public License as published by
df3bb2
+# the Free Software Foundation; either version 2 of the License, or
df3bb2
+# (at your option) any later version.
df3bb2
+#
df3bb2
+# This program is distributed in the hope that it will be useful,
df3bb2
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
df3bb2
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
df3bb2
+# GNU General Public License for more details.
df3bb2
+#
df3bb2
+# You should have received a copy of the GNU General Public License
df3bb2
+# along with this program; if not, write to the Free Software
df3bb2
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
df3bb2
+
df3bb2
+# Test -oo "?" option.
df3bb2
+
df3bb2
+set -e
df3bb2
+
df3bb2
+$TEST_FUNCTIONS
df3bb2
+skip_if_skipped
df3bb2
+
df3bb2
+export VIRT_TOOLS_DATA_DIR="$top_srcdir/test-data/fake-virt-tools"
df3bb2
+export VIRTIO_WIN="$top_srcdir/test-data/fake-virtio-win"
df3bb2
+
df3bb2
+f=test-v2v-o-vdsm-oo-query.actual
df3bb2
+rm -f $f
df3bb2
+
df3bb2
+$VG virt-v2v --debug-gc \
df3bb2
+    -o vdsm -oo "?" > $f
df3bb2
+
df3bb2
+grep -- "-oo vdsm-compat" $f
df3bb2
+grep -- "-oo vdsm-image-uuid" $f
df3bb2
+
df3bb2
+rm $f
df3bb2
diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh
df3bb2
index 4ad5d4aad..65ce1234e 100755
df3bb2
--- a/v2v/test-v2v-o-vdsm-options.sh
df3bb2
+++ b/v2v/test-v2v-o-vdsm-options.sh
df3bb2
@@ -16,7 +16,7 @@
df3bb2
 # along with this program; if not, write to the Free Software
df3bb2
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
df3bb2
 
df3bb2
-# Test -o vdsm options --vdsm-*-uuid
df3bb2
+# Test -o vdsm options -oo vdsm-*-uuid
df3bb2
 
df3bb2
 set -e
df3bb2
 set -x
df3bb2
@@ -44,19 +44,19 @@ mkdir $d/12345678-1234-1234-1234-123456789abc/master
df3bb2
 mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms
df3bb2
 mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms/VM
df3bb2
 
df3bb2
-# The --vdsm-*-uuid options don't actually check that the
df3bb2
+# The -oo vdsm-*-uuid options don't actually check that the
df3bb2
 # parameter is a UUID, which is useful here.
df3bb2
 
df3bb2
 $VG virt-v2v --debug-gc \
df3bb2
     -i libvirt -ic "$libvirt_uri" windows \
df3bb2
     -o vdsm -os $d/12345678-1234-1234-1234-123456789abc \
df3bb2
     -of qcow2 \
df3bb2
-    --vdsm-image-uuid IMAGE \
df3bb2
-    --vdsm-vol-uuid VOL \
df3bb2
-    --vdsm-vm-uuid VM \
df3bb2
-    --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
df3bb2
-    --vdsm-compat=1.1 \
df3bb2
-    --vdsm-ovf-flavour=ovirt
df3bb2
+    -oo vdsm-image-uuid=IMAGE \
df3bb2
+    -oo vdsm-vol-uuid=VOL \
df3bb2
+    -oo vdsm-vm-uuid=VM \
df3bb2
+    -oo vdsm-ovf-output=$d/12345678-1234-1234-1234-123456789abc/master/vms/VM \
df3bb2
+    -oo vdsm-compat=1.1 \
df3bb2
+    -oo vdsm-ovf-flavour=ovirt
df3bb2
 
df3bb2
 # Test the OVF metadata was created.
df3bb2
 test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf
df3bb2
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
df3bb2
index 00ba45555..69ca23dfd 100644
df3bb2
--- a/v2v/virt-v2v.pod
df3bb2
+++ b/v2v/virt-v2v.pod
df3bb2
@@ -397,6 +397,47 @@ See L</IN PLACE CONVERSION> below.
df3bb2
 
df3bb2
 Conflicts with all I<-o *> options.
df3bb2
 
df3bb2
+=item B<-io> OPTION=VALUE
df3bb2
+
df3bb2
+Set input option(s) related to the current input mode or transport.
df3bb2
+To display short help on what options are available you can use:
df3bb2
+
df3bb2
+ virt-v2v -it vddk -io "?"
df3bb2
+
df3bb2
+=item B<-io vddk-libdir=>LIBDIR
df3bb2
+
df3bb2
+Set the VDDK library directory.  This directory should I<contain>
df3bb2
+subdirectories called F<include>, F<lib64> etc., but do not include
df3bb2
+F<lib64> actually in the parameter.
df3bb2
+
df3bb2
+In most cases this parameter is required when using the I<-it vddk>
df3bb2
+(VDDK) transport.  See L</INPUT FROM VDDK> below for details.
df3bb2
+
df3bb2
+=item B<-io vddk-thumbprint=>xx:xx:xx:...
df3bb2
+
df3bb2
+Set the thumbprint of the remote VMware server.
df3bb2
+
df3bb2
+This parameter is required when using the I<-it vddk> (VDDK) transport.
df3bb2
+See L</INPUT FROM VDDK> below for details.
df3bb2
+
df3bb2
+=item B<-io vddk-config=>FILENAME
df3bb2
+
df3bb2
+=item B<-io vddk-cookie=>COOKIE
df3bb2
+
df3bb2
+=item B<-io vddk-nfchostport=>PORT
df3bb2
+
df3bb2
+=item B<-io vddk-port=>PORT
df3bb2
+
df3bb2
+=item B<-io vddk-snapshot=>SNAPSHOT-MOREF
df3bb2
+
df3bb2
+=item B<-io vddk-transports=>MODE:MODE:...
df3bb2
+
df3bb2
+=item B<-io vddk-vimapiver=>APIVER
df3bb2
+
df3bb2
+When using VDDK mode, these options are passed unmodified to the
df3bb2
+L<nbdkit(1)> VDDK plugin.  Please refer to L<nbdkit-vddk-plugin(1)>.
df3bb2
+These are all optional.
df3bb2
+
df3bb2
 =item B<-it> B<ssh>
df3bb2
 
df3bb2
 When using I<-i vmx>, this enables the ssh transport.
df3bb2
@@ -406,7 +447,7 @@ See L</INPUT FROM VMWARE VMX> below.
df3bb2
 
df3bb2
 Use VMware VDDK as a transport to copy the input disks.  See
df3bb2
 L</INPUT FROM VDDK> below.  If you use this parameter then you may
df3bb2
-need to use other I<--vddk*> options to specify how to connect through
df3bb2
+need to use other I<-io vddk*> options to specify how to connect through
df3bb2
 VDDK.
df3bb2
 
df3bb2
 =item B<--keys-from-stdin>
df3bb2
@@ -569,6 +610,95 @@ If not specified, then the input format is used.
df3bb2
 Rename the guest when converting it.  If this option is not used then
df3bb2
 the output name is the same as the input name.
df3bb2
 
df3bb2
+=item B<-oo> OPTION=VALUE
df3bb2
+
df3bb2
+Set output option(s) related to the current output mode.
df3bb2
+To display short help on what options are available you can use:
df3bb2
+
df3bb2
+ virt-v2v -o vdsm -oo "?"
df3bb2
+
df3bb2
+=item B<-oo vdsm-compat=0.10>
df3bb2
+
df3bb2
+=item B<-oo vdsm-compat=1.1>
df3bb2
+
df3bb2
+If I<-o vdsm> and the output format is qcow2, then we add the qcow2
df3bb2
+I<compat=0.10> option to the output file for compatibility with RHEL 6
df3bb2
+(see L<https://bugzilla.redhat.com/1145582>).
df3bb2
+
df3bb2
+If I<-oo vdsm-compat=1.1> is used then modern qcow2 (I<compat=1.1>)
df3bb2
+files are generated instead.
df3bb2
+
df3bb2
+Currently I<-oo vdsm-compat=0.10> is the default, but this will change
df3bb2
+to I<-oo vdsm-compat=1.1> in a future version of virt-v2v (when we can
df3bb2
+assume that everyone is using a modern version of qemu).
df3bb2
+
df3bb2
+B<Note this option only affects I<-o vdsm> output>.  All other output
df3bb2
+modes (including I<-o rhv>) generate modern qcow2 I<compat=1.1>
df3bb2
+files, always.
df3bb2
+
df3bb2
+If this option is available, then C<vdsm-compat-option> will appear in
df3bb2
+the I<--machine-readable> output.
df3bb2
+
df3bb2
+=item B<-oo vdsm-image-uuid=>UUID
df3bb2
+
df3bb2
+=item B<-oo vdsm-vol-uuid=>UUID
df3bb2
+
df3bb2
+=item B<-oo vdsm-vm-uuid=>UUID
df3bb2
+
df3bb2
+=item B<-oo vdsm-ovf-output=>DIR
df3bb2
+
df3bb2
+Normally the RHV output mode chooses random UUIDs for the target
df3bb2
+guest.  However VDSM needs to control the UUIDs and passes these
df3bb2
+parameters when virt-v2v runs under VDSM control.  The parameters
df3bb2
+control:
df3bb2
+
df3bb2
+=over 4
df3bb2
+
df3bb2
+=item *
df3bb2
+
df3bb2
+the image directory of each guest disk (I<-oo vdsm-image-uuid>) (this
df3bb2
+option is passed once for each guest disk)
df3bb2
+
df3bb2
+=item *
df3bb2
+
df3bb2
+UUIDs for each guest disk (I<-oo vdsm-vol-uuid>) (this option
df3bb2
+is passed once for each guest disk)
df3bb2
+
df3bb2
+=item *
df3bb2
+
df3bb2
+the OVF file name (I<-oo vdsm-vm-uuid>).
df3bb2
+
df3bb2
+=item *
df3bb2
+
df3bb2
+the OVF output directory (default current directory) (I<-oo vdsm-ovf-output>).
df3bb2
+
df3bb2
+=back
df3bb2
+
df3bb2
+The format of UUIDs is: C<12345678-1234-1234-1234-123456789abc> (each
df3bb2
+hex digit can be C<0-9> or C<a-f>), conforming to S<OSF DCE 1.1>.
df3bb2
+
df3bb2
+These options can only be used with I<-o vdsm>.
df3bb2
+
df3bb2
+=item B<-oo vdsm-ovf-flavour=>flavour
df3bb2
+
df3bb2
+This option controls the format of the OVF generated at the end of conversion.
df3bb2
+Currently there are two possible flavours:
df3bb2
+
df3bb2
+=over 4
df3bb2
+
df3bb2
+=item rhevexp
df3bb2
+
df3bb2
+The OVF format used in RHV export storage domain.
df3bb2
+
df3bb2
+=item ovirt
df3bb2
+
df3bb2
+The OVF format understood by oVirt REST API.
df3bb2
+
df3bb2
+=back
df3bb2
+
df3bb2
+For backward compatibility the default is I<rhevexp>, but this may change in
df3bb2
+the future.
df3bb2
+
df3bb2
 =item B<-op> file
df3bb2
 
df3bb2
 Supply a file containing a password to be used when connecting to the
df3bb2
@@ -670,122 +800,6 @@ boot an operating system from the first virtio disk.  Specifically,
df3bb2
 F</boot> must be on the first virtio disk, and it cannot chainload an
df3bb2
 OS which is not in the first virtio disk.
df3bb2
 
df3bb2
-=item B<--vddk-libdir> LIBDIR
df3bb2
-
df3bb2
-Set the VDDK library directory.  This directory should I<contain>
df3bb2
-subdirectories called F<include>, F<lib64> etc., but do not include
df3bb2
-F<lib64> actually in the parameter.
df3bb2
-
df3bb2
-In most cases this parameter is required when using the I<-it vddk>
df3bb2
-(VDDK) transport.  See L</INPUT FROM VDDK> below for details.
df3bb2
-
df3bb2
-=item B<--vddk-thumbprint> xx:xx:xx:...
df3bb2
-
df3bb2
-Set the thumbprint of the remote VMware server.
df3bb2
-
df3bb2
-This parameter is required when using the I<-it vddk> (VDDK) transport.
df3bb2
-See L</INPUT FROM VDDK> below for details.
df3bb2
-
df3bb2
-=item B<--vddk-config> FILENAME
df3bb2
-
df3bb2
-=item B<--vddk-cookie> COOKIE
df3bb2
-
df3bb2
-=item B<--vddk-nfchostport> PORT
df3bb2
-
df3bb2
-=item B<--vddk-port> PORT
df3bb2
-
df3bb2
-=item B<--vddk-snapshot> SNAPSHOT-MOREF
df3bb2
-
df3bb2
-=item B<--vddk-transports> MODE:MODE:...
df3bb2
-
df3bb2
-=item B<--vddk-vimapiver> APIVER
df3bb2
-
df3bb2
-When using VDDK mode, these options are passed unmodified to the
df3bb2
-L<nbdkit(1)> VDDK plugin.  Please refer to L<nbdkit-vddk-plugin(1)>.
df3bb2
-These are all optional.
df3bb2
-
df3bb2
-=item B<--vdsm-compat=0.10>
df3bb2
-
df3bb2
-=item B<--vdsm-compat=1.1>
df3bb2
-
df3bb2
-If I<-o vdsm> and the output format is qcow2, then we add the qcow2
df3bb2
-I<compat=0.10> option to the output file for compatibility with RHEL 6
df3bb2
-(see L<https://bugzilla.redhat.com/1145582>).
df3bb2
-
df3bb2
-If I<--vdsm-compat=1.1> is used then modern qcow2 (I<compat=1.1>)
df3bb2
-files are generated instead.
df3bb2
-
df3bb2
-Currently I<--vdsm-compat=0.10> is the default, but this will change
df3bb2
-to I<--vdsm-compat=1.1> in a future version of virt-v2v (when we can
df3bb2
-assume that everyone is using a modern version of qemu).
df3bb2
-
df3bb2
-B<Note this option only affects I<-o vdsm> output>.  All other output
df3bb2
-modes (including I<-o rhv>) generate modern qcow2 I<compat=1.1>
df3bb2
-files, always.
df3bb2
-
df3bb2
-If this option is available, then C<vdsm-compat-option> will appear in
df3bb2
-the I<--machine-readable> output.
df3bb2
-
df3bb2
-=item B<--vdsm-image-uuid> UUID
df3bb2
-
df3bb2
-=item B<--vdsm-vol-uuid> UUID
df3bb2
-
df3bb2
-=item B<--vdsm-vm-uuid> UUID
df3bb2
-
df3bb2
-=item B<--vdsm-ovf-output>
df3bb2
-
df3bb2
-Normally the RHV output mode chooses random UUIDs for the target
df3bb2
-guest.  However VDSM needs to control the UUIDs and passes these
df3bb2
-parameters when virt-v2v runs under VDSM control.  The parameters
df3bb2
-control:
df3bb2
-
df3bb2
-=over 4
df3bb2
-
df3bb2
-=item *
df3bb2
-
df3bb2
-the image directory of each guest disk (I<--vdsm-image-uuid>) (this
df3bb2
-option is passed once for each guest disk)
df3bb2
-
df3bb2
-=item *
df3bb2
-
df3bb2
-UUIDs for each guest disk (I<--vdsm-vol-uuid>) (this option
df3bb2
-is passed once for each guest disk)
df3bb2
-
df3bb2
-=item *
df3bb2
-
df3bb2
-the OVF file name (I<--vdsm-vm-uuid>).
df3bb2
-
df3bb2
-=item *
df3bb2
-
df3bb2
-the OVF output directory (default current directory) (I<--vdsm-ovf-output>).
df3bb2
-
df3bb2
-=back
df3bb2
-
df3bb2
-The format of UUIDs is: C<12345678-1234-1234-1234-123456789abc> (each
df3bb2
-hex digit can be C<0-9> or C<a-f>), conforming to S<OSF DCE 1.1>.
df3bb2
-
df3bb2
-These options can only be used with I<-o vdsm>.
df3bb2
-
df3bb2
-=item B<--vdsm-ovf-flavour> flavour
df3bb2
-
df3bb2
-This option controls the format of the OVF generated at the end of conversion.
df3bb2
-Currently there are two possible flavours:
df3bb2
-
df3bb2
-=over 4
df3bb2
-
df3bb2
-=item rhevexp
df3bb2
-
df3bb2
-The OVF format used in RHV export storage domain.
df3bb2
-
df3bb2
-=item ovirt
df3bb2
-
df3bb2
-The OVF format understood by oVirt REST API.
df3bb2
-
df3bb2
-=back
df3bb2
-
df3bb2
-For backward compatibility the default is I<rhevexp>, but this may change in
df3bb2
-the future.
df3bb2
-
df3bb2
 =item B<-v>
df3bb2
 
df3bb2
 =item B<--verbose>
df3bb2
@@ -1679,15 +1693,15 @@ SSL thumbprint:
df3bb2
  $ virt-v2v \
df3bb2
      -ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1' \
df3bb2
      -it vddk \
df3bb2
-     --vddk-libdir /path/to/vmware-vix-disklib-distrib \
df3bb2
-     --vddk-thumbprint xx:xx:xx:... \
df3bb2
+     -io vddk-libdir=/path/to/vmware-vix-disklib-distrib \
df3bb2
+     -io vddk-thumbprint=xx:xx:xx:... \
df3bb2
      "Windows 2003" \
df3bb2
      -o local -os /var/tmp
df3bb2
 
df3bb2
 Other options that you might need to add in rare circumstances include
df3bb2
-I<--vddk-config>, I<--vddk-cookie>, I<--vddk-nfchostport>,
df3bb2
-I<--vddk-port>, I<--vddk-snapshot>, I<--vddk-transports> and
df3bb2
-I<--vddk-vimapiver>, which are all explained in the
df3bb2
+I<-io vddk-config>, I<-io vddk-cookie>, I<-io vddk-nfchostport>,
df3bb2
+I<-io vddk-port>, I<-io vddk-snapshot>, I<-io vddk-transports> and
df3bb2
+I<-io vddk-vimapiver>, which are all explained in the
df3bb2
 L<nbdkit-vddk-plugin(1)> documentation.
df3bb2
 
df3bb2
 =head2 VDDK: DEBUGGING VDDK FAILURES
df3bb2
-- 
df3bb2
2.21.0
df3bb2