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