|
|
a30de4 |
From f8209cc000c28648efd4d73eeeec7bac3dd7c1dd Mon Sep 17 00:00:00 2001
|
|
|
a30de4 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
a30de4 |
Date: Thu, 7 Dec 2017 14:41:32 +0000
|
|
|
a30de4 |
Subject: [PATCH] =?UTF-8?q?v2v:=20vddk:=20Switch=20to=20using=20=E2=80=98-?=
|
|
|
a30de4 |
=?UTF-8?q?it=20vddk=E2=80=99=20to=20specify=20VDDK=20as=20input=20transpo?=
|
|
|
a30de4 |
=?UTF-8?q?rt.?=
|
|
|
a30de4 |
MIME-Version: 1.0
|
|
|
a30de4 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a30de4 |
Content-Transfer-Encoding: 8bit
|
|
|
a30de4 |
|
|
|
a30de4 |
Previously the presence of the ‘--vddk <libdir>’ option magically
|
|
|
a30de4 |
enabled VDDK mode. However we want to introduce other transports for
|
|
|
a30de4 |
VMware conversions so this wasn't a very clean choice.
|
|
|
a30de4 |
|
|
|
a30de4 |
With this commit you must use ‘-it vddk’ to specify that you want VDDK
|
|
|
a30de4 |
as a disk transport. The previous ‘--vddk <libdir>’ option has been
|
|
|
a30de4 |
renamed to ‘--vddk-libdir <libdir>’ to be consistent with the other
|
|
|
a30de4 |
passthrough options, and it is no longer required.
|
|
|
a30de4 |
|
|
|
a30de4 |
A new command line looks like:
|
|
|
a30de4 |
|
|
|
a30de4 |
$ export PATH=/path/to/nbdkit:$PATH
|
|
|
a30de4 |
$ virt-v2v \
|
|
|
a30de4 |
-ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1' \
|
|
|
a30de4 |
| -it vddk \
|
|
|
a30de4 |
| --vddk-libdir /path/to/vmware-vix-disklib-distrib \
|
|
|
a30de4 |
--vddk-thumbprint xx:xx:xx:... \
|
|
|
a30de4 |
"Windows 2003" \
|
|
|
a30de4 |
-o local -os /var/tmp
|
|
|
a30de4 |
|
|
|
a30de4 |
where only the two lines marked with ‘|’ have changed.
|
|
|
a30de4 |
|
|
|
a30de4 |
(cherry picked from commit 6f347b4f802717d4557fdae90c90afa030b8a414)
|
|
|
a30de4 |
---
|
|
|
a30de4 |
v2v/cmdline.ml | 69 +++++++++++++++++++++++++++++------------------
|
|
|
a30de4 |
v2v/input_libvirt.ml | 37 ++++++++++++-------------
|
|
|
a30de4 |
v2v/input_libvirt.mli | 8 +++---
|
|
|
a30de4 |
v2v/input_libvirt_vddk.ml | 61 ++++++++++++++++++++++++++++-------------
|
|
|
a30de4 |
v2v/test-v2v-docs.sh | 2 +-
|
|
|
a30de4 |
v2v/types.ml | 2 +-
|
|
|
a30de4 |
v2v/types.mli | 2 +-
|
|
|
a30de4 |
v2v/virt-v2v.pod | 30 +++++++++++++++------
|
|
|
a30de4 |
8 files changed, 131 insertions(+), 80 deletions(-)
|
|
|
a30de4 |
|
|
|
a30de4 |
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
|
|
|
a30de4 |
index dfbb776ab..81562d1f5 100644
|
|
|
a30de4 |
--- a/v2v/cmdline.ml
|
|
|
a30de4 |
+++ b/v2v/cmdline.ml
|
|
|
a30de4 |
@@ -56,15 +56,16 @@ let parse_cmdline () =
|
|
|
a30de4 |
|
|
|
a30de4 |
let input_conn = ref None in
|
|
|
a30de4 |
let input_format = ref None in
|
|
|
a30de4 |
+ let input_transport = ref None in
|
|
|
a30de4 |
let in_place = ref false in
|
|
|
a30de4 |
let output_conn = ref None in
|
|
|
a30de4 |
let output_format = ref None in
|
|
|
a30de4 |
let output_name = ref None in
|
|
|
a30de4 |
let output_storage = ref None in
|
|
|
a30de4 |
let password_file = ref None in
|
|
|
a30de4 |
- let vddk = ref None in
|
|
|
a30de4 |
let vddk_config = ref None in
|
|
|
a30de4 |
let vddk_cookie = ref None in
|
|
|
a30de4 |
+ let vddk_libdir = ref None in
|
|
|
a30de4 |
let vddk_nfchostport = ref None in
|
|
|
a30de4 |
let vddk_port = ref None in
|
|
|
a30de4 |
let vddk_snapshot = ref None in
|
|
|
a30de4 |
@@ -186,6 +187,8 @@ let parse_cmdline () =
|
|
|
a30de4 |
s_"Libvirt URI";
|
|
|
a30de4 |
[ M"if" ], Getopt.String ("format", set_string_option_once "-if" input_format),
|
|
|
a30de4 |
s_"Input format (for -i disk)";
|
|
|
a30de4 |
+ [ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport),
|
|
|
a30de4 |
+ s_"Input transport";
|
|
|
a30de4 |
[ L"in-place" ], Getopt.Set in_place, "";
|
|
|
a30de4 |
[ L"machine-readable" ], Getopt.Set machine_readable, s_"Make output machine readable";
|
|
|
a30de4 |
[ S 'n'; L"network" ], Getopt.String ("in:out", add_network), s_"Map network 'in' to 'out'";
|
|
|
a30de4 |
@@ -207,12 +210,12 @@ let parse_cmdline () =
|
|
|
a30de4 |
s_"Use password from file";
|
|
|
a30de4 |
[ L"print-source" ], Getopt.Set print_source, s_"Print source and stop";
|
|
|
a30de4 |
[ L"root" ], Getopt.String ("ask|... ", set_root_choice), s_"How to choose root filesystem";
|
|
|
a30de4 |
- [ L"vddk" ], Getopt.String ("libpath", set_string_option_once "--vddk" vddk),
|
|
|
a30de4 |
- s_"Use nbdkit VDDK plugin";
|
|
|
a30de4 |
[ L"vddk-config" ], Getopt.String ("filename", set_string_option_once "--vddk-config" vddk_config),
|
|
|
a30de4 |
s_"Set VDDK config file";
|
|
|
a30de4 |
[ L"vddk-cookie" ], Getopt.String ("cookie", set_string_option_once "--vddk-cookie" vddk_cookie),
|
|
|
a30de4 |
s_"Set VDDK cookie";
|
|
|
a30de4 |
+ [ L"vddk-libdir" ], Getopt.String ("libdir", set_string_option_once "--vddk-libdir" vddk_libdir),
|
|
|
a30de4 |
+ s_"Set VDDK library parent directory";
|
|
|
a30de4 |
[ L"vddk-nfchostport" ], Getopt.String ("nfchostport", set_string_option_once "--vddk-nfchostport" vddk_nfchostport),
|
|
|
a30de4 |
s_"Set VDDK nfchostport";
|
|
|
a30de4 |
[ L"vddk-port" ], Getopt.String ("port", set_string_option_once "--vddk-port" vddk_port),
|
|
|
a30de4 |
@@ -270,6 +273,12 @@ read the man page virt-v2v(1).
|
|
|
a30de4 |
let input_conn = !input_conn in
|
|
|
a30de4 |
let input_format = !input_format in
|
|
|
a30de4 |
let input_mode = !input_mode in
|
|
|
a30de4 |
+ let input_transport =
|
|
|
a30de4 |
+ match !input_transport with
|
|
|
a30de4 |
+ | None -> None
|
|
|
a30de4 |
+ | Some "vddk" -> Some `VDDK
|
|
|
a30de4 |
+ | Some transport ->
|
|
|
a30de4 |
+ error (f_"unknown input transport ‘-it %s’") transport in
|
|
|
a30de4 |
let in_place = !in_place in
|
|
|
a30de4 |
let machine_readable = !machine_readable in
|
|
|
a30de4 |
let network_map = !network_map in
|
|
|
a30de4 |
@@ -287,28 +296,15 @@ read the man page virt-v2v(1).
|
|
|
a30de4 |
let qemu_boot = !qemu_boot in
|
|
|
a30de4 |
let root_choice = !root_choice in
|
|
|
a30de4 |
let vddk_options =
|
|
|
a30de4 |
- match !vddk with
|
|
|
a30de4 |
- | Some libdir ->
|
|
|
a30de4 |
- Some { vddk_libdir = libdir;
|
|
|
a30de4 |
- vddk_config = !vddk_config;
|
|
|
a30de4 |
- vddk_cookie = !vddk_cookie;
|
|
|
a30de4 |
- vddk_nfchostport = !vddk_nfchostport;
|
|
|
a30de4 |
- vddk_port = !vddk_port;
|
|
|
a30de4 |
- vddk_snapshot = !vddk_snapshot;
|
|
|
a30de4 |
- vddk_thumbprint = !vddk_thumbprint;
|
|
|
a30de4 |
- vddk_transports = !vddk_transports;
|
|
|
a30de4 |
- vddk_vimapiver = !vddk_vimapiver }
|
|
|
a30de4 |
- | None ->
|
|
|
a30de4 |
- if !vddk_config <> None ||
|
|
|
a30de4 |
- !vddk_cookie <> None ||
|
|
|
a30de4 |
- !vddk_nfchostport <> None ||
|
|
|
a30de4 |
- !vddk_port <> None ||
|
|
|
a30de4 |
- !vddk_snapshot <> None ||
|
|
|
a30de4 |
- !vddk_thumbprint <> None ||
|
|
|
a30de4 |
- !vddk_transports <> None ||
|
|
|
a30de4 |
- !vddk_vimapiver <> None then
|
|
|
a30de4 |
- error (f_"‘--vddk-*’ options should only be used when conversion via the nbdkit VDDK plugin has been enabled, ie. using ‘--vddk’.");
|
|
|
a30de4 |
- None in
|
|
|
a30de4 |
+ { vddk_config = !vddk_config;
|
|
|
a30de4 |
+ vddk_cookie = !vddk_cookie;
|
|
|
a30de4 |
+ vddk_libdir = !vddk_libdir;
|
|
|
a30de4 |
+ vddk_nfchostport = !vddk_nfchostport;
|
|
|
a30de4 |
+ vddk_port = !vddk_port;
|
|
|
a30de4 |
+ vddk_snapshot = !vddk_snapshot;
|
|
|
a30de4 |
+ vddk_thumbprint = !vddk_thumbprint;
|
|
|
a30de4 |
+ vddk_transports = !vddk_transports;
|
|
|
a30de4 |
+ vddk_vimapiver = !vddk_vimapiver } in
|
|
|
a30de4 |
let vdsm_compat = !vdsm_compat in
|
|
|
a30de4 |
let vdsm_image_uuids = List.rev !vdsm_image_uuids in
|
|
|
a30de4 |
let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
|
|
|
a30de4 |
@@ -341,6 +337,26 @@ read the man page virt-v2v(1).
|
|
|
a30de4 |
let password = read_first_line_from_file filename in
|
|
|
a30de4 |
Some password in
|
|
|
a30de4 |
|
|
|
a30de4 |
+ (* Input transport affects whether some parameters should or
|
|
|
a30de4 |
+ * should not be used.
|
|
|
a30de4 |
+ *)
|
|
|
a30de4 |
+ (match input_transport with
|
|
|
a30de4 |
+ | None ->
|
|
|
a30de4 |
+ if !vddk_config <> None ||
|
|
|
a30de4 |
+ !vddk_cookie <> None ||
|
|
|
a30de4 |
+ !vddk_libdir <> None ||
|
|
|
a30de4 |
+ !vddk_nfchostport <> None ||
|
|
|
a30de4 |
+ !vddk_port <> None ||
|
|
|
a30de4 |
+ !vddk_snapshot <> None ||
|
|
|
a30de4 |
+ !vddk_thumbprint <> None ||
|
|
|
a30de4 |
+ !vddk_transports <> None ||
|
|
|
a30de4 |
+ !vddk_vimapiver <> None then
|
|
|
a30de4 |
+ error (f_"‘--vddk-*’ options should only be used when conversion via the nbdkit VDDK plugin has been enabled, ie. using ‘-it vddk’.")
|
|
|
a30de4 |
+ | Some `VDDK ->
|
|
|
a30de4 |
+ if !vddk_thumbprint = None then
|
|
|
a30de4 |
+ error (f_"‘--vddk-thumbprint’ is required when using ‘-it vddk’.")
|
|
|
a30de4 |
+ );
|
|
|
a30de4 |
+
|
|
|
a30de4 |
(* Parsing of the argument(s) depends on the input mode. *)
|
|
|
a30de4 |
let input =
|
|
|
a30de4 |
match input_mode with
|
|
|
a30de4 |
@@ -363,7 +379,8 @@ read the man page virt-v2v(1).
|
|
|
a30de4 |
| [guest] -> guest
|
|
|
a30de4 |
| _ ->
|
|
|
a30de4 |
error (f_"expecting a libvirt guest name on the command line") in
|
|
|
a30de4 |
- Input_libvirt.input_libvirt vddk_options password input_conn guest
|
|
|
a30de4 |
+ Input_libvirt.input_libvirt vddk_options password
|
|
|
a30de4 |
+ input_conn input_transport guest
|
|
|
a30de4 |
|
|
|
a30de4 |
| `LibvirtXML ->
|
|
|
a30de4 |
(* -i libvirtxml: Expecting a filename (XML file). *)
|
|
|
a30de4 |
diff --git a/v2v/input_libvirt.ml b/v2v/input_libvirt.ml
|
|
|
a30de4 |
index f4a8114f0..16006dc0c 100644
|
|
|
a30de4 |
--- a/v2v/input_libvirt.ml
|
|
|
a30de4 |
+++ b/v2v/input_libvirt.ml
|
|
|
a30de4 |
@@ -27,7 +27,7 @@ open Types
|
|
|
a30de4 |
open Utils
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Choose the right subclass based on the URI. *)
|
|
|
a30de4 |
-let input_libvirt vddk_options password libvirt_uri guest =
|
|
|
a30de4 |
+let input_libvirt vddk_options password libvirt_uri input_transport guest =
|
|
|
a30de4 |
match libvirt_uri with
|
|
|
a30de4 |
| None ->
|
|
|
a30de4 |
Input_libvirt_other.input_libvirt_other password libvirt_uri guest
|
|
|
a30de4 |
@@ -39,29 +39,26 @@ let input_libvirt vddk_options password libvirt_uri guest =
|
|
|
a30de4 |
error (f_"could not parse '-ic %s'. Original error message was: %s")
|
|
|
a30de4 |
orig_uri msg in
|
|
|
a30de4 |
|
|
|
a30de4 |
- match server, scheme with
|
|
|
a30de4 |
- | None, _
|
|
|
a30de4 |
- | Some "", _ (* Not a remote URI. *)
|
|
|
a30de4 |
+ match server, scheme, input_transport with
|
|
|
a30de4 |
+ | None, _, _
|
|
|
a30de4 |
+ | Some "", _, _ (* Not a remote URI. *)
|
|
|
a30de4 |
|
|
|
a30de4 |
- | Some _, None (* No scheme? *)
|
|
|
a30de4 |
- | Some _, Some "" ->
|
|
|
a30de4 |
+ | Some _, None, _ (* No scheme? *)
|
|
|
a30de4 |
+ | Some _, Some "", _ ->
|
|
|
a30de4 |
Input_libvirt_other.input_libvirt_other password libvirt_uri guest
|
|
|
a30de4 |
|
|
|
a30de4 |
- (* vCenter over https, or
|
|
|
a30de4 |
- * vCenter or ESXi using nbdkit vddk plugin
|
|
|
a30de4 |
- *)
|
|
|
a30de4 |
- | Some server, Some ("esx"|"gsx"|"vpx" as scheme) ->
|
|
|
a30de4 |
- (match vddk_options with
|
|
|
a30de4 |
- | None ->
|
|
|
a30de4 |
- Input_libvirt_vcenter_https.input_libvirt_vcenter_https
|
|
|
a30de4 |
- password libvirt_uri parsed_uri scheme server guest
|
|
|
a30de4 |
- | Some vddk_options ->
|
|
|
a30de4 |
- Input_libvirt_vddk.input_libvirt_vddk vddk_options password
|
|
|
a30de4 |
- libvirt_uri parsed_uri guest
|
|
|
a30de4 |
- )
|
|
|
a30de4 |
+ (* vCenter over https. *)
|
|
|
a30de4 |
+ | Some server, Some ("esx"|"gsx"|"vpx" as scheme), None ->
|
|
|
a30de4 |
+ Input_libvirt_vcenter_https.input_libvirt_vcenter_https
|
|
|
a30de4 |
+ password libvirt_uri parsed_uri scheme server guest
|
|
|
a30de4 |
+
|
|
|
a30de4 |
+ (* vCenter or ESXi using nbdkit vddk plugin *)
|
|
|
a30de4 |
+ | Some server, Some ("esx"|"gsx"|"vpx"), Some `VDDK ->
|
|
|
a30de4 |
+ Input_libvirt_vddk.input_libvirt_vddk vddk_options password
|
|
|
a30de4 |
+ libvirt_uri parsed_uri guest
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Xen over SSH *)
|
|
|
a30de4 |
- | Some server, Some ("xen+ssh" as scheme) ->
|
|
|
a30de4 |
+ | Some server, Some ("xen+ssh" as scheme), _ ->
|
|
|
a30de4 |
Input_libvirt_xen_ssh.input_libvirt_xen_ssh
|
|
|
a30de4 |
password libvirt_uri parsed_uri scheme server guest
|
|
|
a30de4 |
|
|
|
a30de4 |
@@ -71,7 +68,7 @@ let input_libvirt vddk_options password libvirt_uri guest =
|
|
|
a30de4 |
*)
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Unknown remote scheme. *)
|
|
|
a30de4 |
- | Some _, Some _ ->
|
|
|
a30de4 |
+ | Some _, Some _, _ ->
|
|
|
a30de4 |
warning (f_"no support for remote libvirt connections to '-ic %s'. The conversion may fail when it tries to read the source disks.")
|
|
|
a30de4 |
orig_uri;
|
|
|
a30de4 |
Input_libvirt_other.input_libvirt_other password libvirt_uri guest
|
|
|
a30de4 |
diff --git a/v2v/input_libvirt.mli b/v2v/input_libvirt.mli
|
|
|
a30de4 |
index acf2ca417..eb3e48397 100644
|
|
|
a30de4 |
--- a/v2v/input_libvirt.mli
|
|
|
a30de4 |
+++ b/v2v/input_libvirt.mli
|
|
|
a30de4 |
@@ -18,7 +18,7 @@
|
|
|
a30de4 |
|
|
|
a30de4 |
(** [-i libvirt] source. *)
|
|
|
a30de4 |
|
|
|
a30de4 |
-val input_libvirt : Types.vddk_options option -> string option -> string option -> string -> Types.input
|
|
|
a30de4 |
-(** [input_libvirt vddk_options password libvirt_uri guest] creates
|
|
|
a30de4 |
- and returns a new {!Types.input} object specialized for reading input
|
|
|
a30de4 |
- from libvirt sources. *)
|
|
|
a30de4 |
+val input_libvirt : Types.vddk_options -> string option -> string option -> [`VDDK] option -> string -> Types.input
|
|
|
a30de4 |
+(** [input_libvirt vddk_options password libvirt_uri input_transport guest]
|
|
|
a30de4 |
+ creates and returns a new {!Types.input} object specialized for reading
|
|
|
a30de4 |
+ input from libvirt sources. *)
|
|
|
a30de4 |
diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml
|
|
|
a30de4 |
index d1f2ae360..2f2ac4214 100644
|
|
|
a30de4 |
--- a/v2v/input_libvirt_vddk.ml
|
|
|
a30de4 |
+++ b/v2v/input_libvirt_vddk.ml
|
|
|
a30de4 |
@@ -34,11 +34,19 @@ open Printf
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Subclass specialized for handling VMware via nbdkit vddk plugin. *)
|
|
|
a30de4 |
class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest =
|
|
|
a30de4 |
-
|
|
|
a30de4 |
(* The VDDK path. *)
|
|
|
a30de4 |
let libdir = vddk_options.vddk_libdir in
|
|
|
a30de4 |
- (* Compute the LD_LIBRARY_PATH that we must pass to nbdkit. *)
|
|
|
a30de4 |
- let library_path = libdir // sprintf "lib%d" Sys.word_size in
|
|
|
a30de4 |
+
|
|
|
a30de4 |
+ (* VDDK libraries are located under lib32/ or lib64/ relative to the
|
|
|
a30de4 |
+ * libdir. Note this is unrelated to Linux multilib or multiarch.
|
|
|
a30de4 |
+ *)
|
|
|
a30de4 |
+ let libNN = sprintf "lib%d" Sys.word_size in
|
|
|
a30de4 |
+
|
|
|
a30de4 |
+ (* Compute the LD_LIBRARY_PATH that we may have to pass to nbdkit. *)
|
|
|
a30de4 |
+ let library_path =
|
|
|
a30de4 |
+ match libdir with
|
|
|
a30de4 |
+ | None -> None
|
|
|
a30de4 |
+ | Some libdir -> Some (libdir // libNN) in
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Is SELinux enabled and enforcing on the host? *)
|
|
|
a30de4 |
let have_selinux =
|
|
|
a30de4 |
@@ -46,18 +54,25 @@ class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest =
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Check that the VDDK path looks reasonable. *)
|
|
|
a30de4 |
let error_unless_vddk_libdir () =
|
|
|
a30de4 |
- if not (is_directory libdir) then
|
|
|
a30de4 |
- error (f_"‘--vddk %s’ does not point to a directory. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libdir;
|
|
|
a30de4 |
+ (match libdir with
|
|
|
a30de4 |
+ | None -> ()
|
|
|
a30de4 |
+ | Some libdir ->
|
|
|
a30de4 |
+ if not (is_directory libdir) then
|
|
|
a30de4 |
+ error (f_"‘--vddk-libdir %s’ does not point to a directory. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libdir
|
|
|
a30de4 |
+ );
|
|
|
a30de4 |
|
|
|
a30de4 |
- if not (is_directory library_path) then
|
|
|
a30de4 |
- error (f_"VDDK library path %s not found or not a directory. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.")
|
|
|
a30de4 |
- library_path
|
|
|
a30de4 |
+ (match library_path with
|
|
|
a30de4 |
+ | None -> ()
|
|
|
a30de4 |
+ | Some library_path ->
|
|
|
a30de4 |
+ if not (is_directory library_path) then
|
|
|
a30de4 |
+ error (f_"VDDK library path %s not found or not a directory. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") library_path
|
|
|
a30de4 |
+ )
|
|
|
a30de4 |
in
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Check that nbdkit is available and new enough. *)
|
|
|
a30de4 |
let error_unless_nbdkit_working () =
|
|
|
a30de4 |
if 0 <> Sys.command "nbdkit --version >/dev/null" then
|
|
|
a30de4 |
- error (f_"nbdkit is not installed or not working. It is required to use ‘--vddk’. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.");
|
|
|
a30de4 |
+ error (f_"nbdkit is not installed or not working. It is required to use ‘-it vddk’. See \"INPUT FROM VDDK\" in the virt-v2v(1) manual.");
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Check it's a new enough version. The latest features we
|
|
|
a30de4 |
* require are ‘--exit-with-parent’ and ‘--selinux-label’, both
|
|
|
a30de4 |
@@ -73,14 +88,20 @@ class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest =
|
|
|
a30de4 |
|
|
|
a30de4 |
(* Check that the VDDK plugin is installed and working *)
|
|
|
a30de4 |
let error_unless_nbdkit_vddk_working () =
|
|
|
a30de4 |
+ let set_ld_library_path =
|
|
|
a30de4 |
+ match library_path with
|
|
|
a30de4 |
+ | None -> ""
|
|
|
a30de4 |
+ | Some library_path ->
|
|
|
a30de4 |
+ sprintf "LD_LIBRARY_PATH=%s " (quote library_path) in
|
|
|
a30de4 |
+
|
|
|
a30de4 |
let cmd =
|
|
|
a30de4 |
- sprintf "LD_LIBRARY_PATH=%s nbdkit vddk --dump-plugin >/dev/null"
|
|
|
a30de4 |
- (quote library_path) in
|
|
|
a30de4 |
+ sprintf "%snbdkit vddk --dump-plugin >/dev/null"
|
|
|
a30de4 |
+ set_ld_library_path in
|
|
|
a30de4 |
if Sys.command cmd <> 0 then (
|
|
|
a30de4 |
(* See if we can diagnose why ... *)
|
|
|
a30de4 |
let cmd =
|
|
|
a30de4 |
- sprintf "LD_LIBRARY_PATH=%s LANG=C nbdkit vddk --dump-plugin 2>&1 | grep -sq libvixDiskLib.so"
|
|
|
a30de4 |
- (quote library_path) in
|
|
|
a30de4 |
+ sprintf "LANG=C %snbdkit vddk --dump-plugin 2>&1 | grep -sq libvixDiskLib.so"
|
|
|
a30de4 |
+ set_ld_library_path in
|
|
|
a30de4 |
let needs_library = Sys.command cmd = 0 in
|
|
|
a30de4 |
if not needs_library then
|
|
|
a30de4 |
error (f_"nbdkit VDDK plugin is not installed or not working. It is required if you want to use VDDK.
|
|
|
a30de4 |
@@ -91,9 +112,9 @@ See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.")
|
|
|
a30de4 |
else
|
|
|
a30de4 |
error (f_"nbdkit VDDK plugin is not installed or not working. It is required if you want to use VDDK.
|
|
|
a30de4 |
|
|
|
a30de4 |
-It looks like you did not set the right path in the ‘--vddk’ option, or your copy of the VDDK directory is incomplete. There should be a library called ’%s/libvixDiskLib.so.?’.
|
|
|
a30de4 |
+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.?’.
|
|
|
a30de4 |
|
|
|
a30de4 |
-See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") library_path
|
|
|
a30de4 |
+See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") libNN
|
|
|
a30de4 |
)
|
|
|
a30de4 |
in
|
|
|
a30de4 |
|
|
|
a30de4 |
@@ -120,6 +141,7 @@ See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") library_path
|
|
|
a30de4 |
let vddk_passthrus =
|
|
|
a30de4 |
[ "config", (fun { vddk_config } -> vddk_config);
|
|
|
a30de4 |
"cookie", (fun { vddk_cookie } -> vddk_cookie);
|
|
|
a30de4 |
+ "libdir", (fun { vddk_libdir } -> vddk_libdir);
|
|
|
a30de4 |
"nfchostport", (fun { vddk_nfchostport } -> vddk_nfchostport);
|
|
|
a30de4 |
"port", (fun { vddk_port } -> vddk_port);
|
|
|
a30de4 |
"snapshot", (fun { vddk_snapshot } -> vddk_snapshot);
|
|
|
a30de4 |
@@ -140,9 +162,8 @@ object
|
|
|
a30de4 |
| Some field -> sprintf " --vddk-%s %s" name field
|
|
|
a30de4 |
) vddk_passthrus
|
|
|
a30de4 |
) in
|
|
|
a30de4 |
- sprintf "%s --vddk %s%s"
|
|
|
a30de4 |
+ sprintf "%s -it vddk %s"
|
|
|
a30de4 |
super#as_options (* superclass prints "-i libvirt etc" *)
|
|
|
a30de4 |
- vddk_options.vddk_libdir
|
|
|
a30de4 |
pt_options
|
|
|
a30de4 |
|
|
|
a30de4 |
method source () =
|
|
|
a30de4 |
@@ -249,7 +270,6 @@ object
|
|
|
a30de4 |
add_arg (sprintf "user=%s" user);
|
|
|
a30de4 |
add_arg password_param;
|
|
|
a30de4 |
add_arg (sprintf "vm=moref=%s" moref);
|
|
|
a30de4 |
- add_arg (sprintf "libdir=%s" libdir);
|
|
|
a30de4 |
|
|
|
a30de4 |
(* The passthrough parameters. *)
|
|
|
a30de4 |
List.iter (
|
|
|
a30de4 |
@@ -299,7 +319,10 @@ object
|
|
|
a30de4 |
let pid = fork () in
|
|
|
a30de4 |
if pid = 0 then (
|
|
|
a30de4 |
(* Child process (nbdkit). *)
|
|
|
a30de4 |
- putenv "LD_LIBRARY_PATH" library_path;
|
|
|
a30de4 |
+ (match library_path with
|
|
|
a30de4 |
+ | None -> ()
|
|
|
a30de4 |
+ | Some x -> putenv "LD_LIBRARY_PATH" x
|
|
|
a30de4 |
+ );
|
|
|
a30de4 |
execvp "nbdkit" args
|
|
|
a30de4 |
);
|
|
|
a30de4 |
|
|
|
a30de4 |
diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh
|
|
|
a30de4 |
index 5e49d5240..c8ca193eb 100755
|
|
|
a30de4 |
--- a/v2v/test-v2v-docs.sh
|
|
|
a30de4 |
+++ b/v2v/test-v2v-docs.sh
|
|
|
a30de4 |
@@ -22,4 +22,4 @@ $TEST_FUNCTIONS
|
|
|
a30de4 |
skip_if_skipped
|
|
|
a30de4 |
|
|
|
a30de4 |
$top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
|
|
|
a30de4 |
- --ignore=--debug-overlay,--ic,--if,--in-place,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
|
|
|
a30de4 |
+ --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
|
|
|
a30de4 |
diff --git a/v2v/types.ml b/v2v/types.ml
|
|
|
a30de4 |
index 4f9205aa0..43bd28804 100644
|
|
|
a30de4 |
--- a/v2v/types.ml
|
|
|
a30de4 |
+++ b/v2v/types.ml
|
|
|
a30de4 |
@@ -473,9 +473,9 @@ type root_choice = AskRoot | SingleRoot | FirstRoot | RootDev of string
|
|
|
a30de4 |
type output_allocation = Sparse | Preallocated
|
|
|
a30de4 |
|
|
|
a30de4 |
type vddk_options = {
|
|
|
a30de4 |
- vddk_libdir : string;
|
|
|
a30de4 |
vddk_config : string option;
|
|
|
a30de4 |
vddk_cookie : string option;
|
|
|
a30de4 |
+ vddk_libdir : string option;
|
|
|
a30de4 |
vddk_nfchostport : string option;
|
|
|
a30de4 |
vddk_port : string option;
|
|
|
a30de4 |
vddk_snapshot : string option;
|
|
|
a30de4 |
diff --git a/v2v/types.mli b/v2v/types.mli
|
|
|
a30de4 |
index 087a03702..fd944bebf 100644
|
|
|
a30de4 |
--- a/v2v/types.mli
|
|
|
a30de4 |
+++ b/v2v/types.mli
|
|
|
a30de4 |
@@ -329,9 +329,9 @@ type output_allocation = Sparse | Preallocated
|
|
|
a30de4 |
(** Type of [-oa] (output allocation) option. *)
|
|
|
a30de4 |
|
|
|
a30de4 |
type vddk_options = {
|
|
|
a30de4 |
- vddk_libdir : string;
|
|
|
a30de4 |
vddk_config : string option;
|
|
|
a30de4 |
vddk_cookie : string option;
|
|
|
a30de4 |
+ vddk_libdir : string option;
|
|
|
a30de4 |
vddk_nfchostport : string option;
|
|
|
a30de4 |
vddk_port : string option;
|
|
|
a30de4 |
vddk_snapshot : string option;
|
|
|
a30de4 |
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
|
|
|
a30de4 |
index e798ad1e7..7aca22b3c 100644
|
|
|
a30de4 |
--- a/v2v/virt-v2v.pod
|
|
|
a30de4 |
+++ b/v2v/virt-v2v.pod
|
|
|
a30de4 |
@@ -255,6 +255,13 @@ For I<-i disk> only, this specifies the format of the input disk
|
|
|
a30de4 |
image. For other input methods you should specify the input
|
|
|
a30de4 |
format in the metadata.
|
|
|
a30de4 |
|
|
|
a30de4 |
+=item B<-it> B<vddk>
|
|
|
a30de4 |
+
|
|
|
a30de4 |
+Use VMware VDDK as a transport to copy the input disks. See
|
|
|
a30de4 |
+L</INPUT FROM VDDK> below. If you use this parameter then you may
|
|
|
a30de4 |
+need to use other I<--vddk*> options to specify how to connect through
|
|
|
a30de4 |
+VDDK.
|
|
|
a30de4 |
+
|
|
|
a30de4 |
=item B<--keys-from-stdin>
|
|
|
a30de4 |
|
|
|
a30de4 |
Read key or passphrase parameters from stdin. The default is
|
|
|
a30de4 |
@@ -501,13 +508,20 @@ boot an operating system from the first VirtIO disk. Specifically,
|
|
|
a30de4 |
F</boot> must be on the first VirtIO disk, and it cannot chainload an
|
|
|
a30de4 |
OS which is not in the first VirtIO disk.
|
|
|
a30de4 |
|
|
|
a30de4 |
-=item B<--vddk> LIBDIR
|
|
|
a30de4 |
+=item B<--vddk-libdir> LIBDIR
|
|
|
a30de4 |
|
|
|
a30de4 |
-Enable VDDK input from VMware vCenter or ESXi. C<LIBDIR> is the top
|
|
|
a30de4 |
-directory of the VDDK library. This directory should I<contain>
|
|
|
a30de4 |
+Set the VDDK library directory. This directory should I<contain>
|
|
|
a30de4 |
subdirectories called F<include>, F<lib64> etc., but do not include
|
|
|
a30de4 |
F<lib64> actually in the parameter.
|
|
|
a30de4 |
|
|
|
a30de4 |
+In most cases this parameter is required when using the I<-it vddk>
|
|
|
a30de4 |
+(VDDK) transport. See L</INPUT FROM VDDK> below for details.
|
|
|
a30de4 |
+
|
|
|
a30de4 |
+=item B<--vddk-thumbprint> xx:xx:xx:...
|
|
|
a30de4 |
+
|
|
|
a30de4 |
+Set the thumbprint of the remote VMware server.
|
|
|
a30de4 |
+
|
|
|
a30de4 |
+This parameter is required when using the I<-it vddk> (VDDK) transport.
|
|
|
a30de4 |
See L</INPUT FROM VDDK> below for details.
|
|
|
a30de4 |
|
|
|
a30de4 |
=item B<--vddk-config> FILENAME
|
|
|
a30de4 |
@@ -520,16 +534,13 @@ See L</INPUT FROM VDDK> below for details.
|
|
|
a30de4 |
|
|
|
a30de4 |
=item B<--vddk-snapshot> SNAPSHOT-MOREF
|
|
|
a30de4 |
|
|
|
a30de4 |
-=item B<--vddk-thumbprint> xx:xx:xx:...
|
|
|
a30de4 |
-
|
|
|
a30de4 |
=item B<--vddk-transports> MODE:MODE:...
|
|
|
a30de4 |
|
|
|
a30de4 |
=item B<--vddk-vimapiver> APIVER
|
|
|
a30de4 |
|
|
|
a30de4 |
When using VDDK mode, these options are passed unmodified to the
|
|
|
a30de4 |
L<nbdkit(1)> VDDK plugin. Please refer to L<nbdkit-vddk-plugin(1)>.
|
|
|
a30de4 |
-If I<--vddk> is present, I<--vddk-thumbprint> is also required,
|
|
|
a30de4 |
-the rest are optional.
|
|
|
a30de4 |
+These are all optional.
|
|
|
a30de4 |
|
|
|
a30de4 |
=item B<--vdsm-compat=0.10>
|
|
|
a30de4 |
|
|
|
a30de4 |
@@ -1390,6 +1401,8 @@ continuing.
|
|
|
a30de4 |
|
|
|
a30de4 |
=head2 VDDK: IMPORTING A GUEST
|
|
|
a30de4 |
|
|
|
a30de4 |
+The I<-it vddk> parameter selects VDDK as the input transport for disks.
|
|
|
a30de4 |
+
|
|
|
a30de4 |
To import a particular guest from vCenter server or ESXi hypervisor,
|
|
|
a30de4 |
use a command like the following, substituting the URI, guest name and
|
|
|
a30de4 |
SSL thumbprint:
|
|
|
a30de4 |
@@ -1397,7 +1410,8 @@ SSL thumbprint:
|
|
|
a30de4 |
$ export PATH=/path/to/nbdkit:$PATH
|
|
|
a30de4 |
$ virt-v2v \
|
|
|
a30de4 |
-ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1' \
|
|
|
a30de4 |
- --vddk /path/to/vmware-vix-disklib-distrib \
|
|
|
a30de4 |
+ -it vddk \
|
|
|
a30de4 |
+ --vddk-libdir /path/to/vmware-vix-disklib-distrib \
|
|
|
a30de4 |
--vddk-thumbprint xx:xx:xx:... \
|
|
|
a30de4 |
"Windows 2003" \
|
|
|
a30de4 |
-o local -os /var/tmp
|
|
|
a30de4 |
--
|
|
|
a30de4 |
2.14.3
|
|
|
a30de4 |
|