Simple refactoring, giving the structures uniform names and handling.
---
v2v/cmdline.ml | 6 +++---
v2v/input_libvirt.mli | 2 +-
v2v/input_libvirt_vddk.ml | 12 ++++++++++++
v2v/input_libvirt_vddk.mli | 15 ++++++++++++++-
v2v/output_vdsm.ml | 44 ++++++++++++++++++++++----------------------
v2v/output_vdsm.mli | 6 +++---
v2v/types.ml | 12 ------------
v2v/types.mli | 13 -------------
8 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
index 14c5c0dca..70e9a3c3b 100644
--- a/v2v/cmdline.ml
+++ b/v2v/cmdline.ml
@@ -329,7 +329,7 @@ read the man page virt-v2v(1).
let qemu_boot = !qemu_boot in
let root_choice = !root_choice in
let vddk_options =
- { vddk_config = !vddk_config;
+ { Input_libvirt_vddk.vddk_config = !vddk_config;
vddk_cookie = !vddk_cookie;
vddk_libdir = !vddk_libdir;
vddk_nfchostport = !vddk_nfchostport;
@@ -574,7 +574,7 @@ read the man page virt-v2v(1).
| Some s -> s in
if vdsm_image_uuids = [] || vdsm_vol_uuids = [] then
error (f_"-o vdsm: either --vdsm-vol-uuid or --vdsm-vm-uuid was not
specified");
- let vdsm_params = {
+ let vdsm_options = {
Output_vdsm.image_uuids = vdsm_image_uuids;
vol_uuids = vdsm_vol_uuids;
vm_uuid = vdsm_vm_uuid;
@@ -582,7 +582,7 @@ read the man page virt-v2v(1).
compat = vdsm_compat;
ovf_flavour = vdsm_ovf_flavour;
} in
- Output_vdsm.output_vdsm os vdsm_params output_alloc,
+ Output_vdsm.output_vdsm os vdsm_options output_alloc,
output_format, output_alloc in
{
diff --git a/v2v/input_libvirt.mli b/v2v/input_libvirt.mli
index 6a521f32e..6f9162482 100644
--- a/v2v/input_libvirt.mli
+++ b/v2v/input_libvirt.mli
@@ -18,7 +18,7 @@
(** [-i libvirt] source. *)
-val input_libvirt : Types.vddk_options -> string option -> string option ->
[`VDDK] option -> string -> Types.input
+val input_libvirt : Input_libvirt_vddk.vddk_options -> string option -> string
option -> [`VDDK] option -> string -> Types.input
(** [input_libvirt vddk_options password libvirt_uri input_transport guest]
creates and returns a new {!Types.input} object specialized for reading
input from libvirt sources. *)
diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml
index 1e1f5b6bd..a53f3e71d 100644
--- a/v2v/input_libvirt_vddk.ml
+++ b/v2v/input_libvirt_vddk.ml
@@ -33,6 +33,18 @@ open Xpath_helpers
open Printf
+type vddk_options = {
+ vddk_config : string option;
+ vddk_cookie : string option;
+ vddk_libdir : string option;
+ vddk_nfchostport : string option;
+ vddk_port : string option;
+ vddk_snapshot : string option;
+ vddk_thumbprint : string option;
+ vddk_transports : string option;
+ vddk_vimapiver : string option;
+}
+
(* Subclass specialized for handling VMware via nbdkit vddk plugin. *)
class input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest =
(* The VDDK path. *)
diff --git a/v2v/input_libvirt_vddk.mli b/v2v/input_libvirt_vddk.mli
index 19a34c202..c8606c72a 100644
--- a/v2v/input_libvirt_vddk.mli
+++ b/v2v/input_libvirt_vddk.mli
@@ -18,7 +18,20 @@
(** [-i libvirt] when the source is VMware via nbdkit vddk plugin *)
-val input_libvirt_vddk : Types.vddk_options -> string option -> string option ->
Xml.uri -> string -> Types.input
+type vddk_options = {
+ vddk_config : string option;
+ vddk_cookie : string option;
+ vddk_libdir : string option;
+ vddk_nfchostport : string option;
+ vddk_port : string option;
+ vddk_snapshot : string option;
+ vddk_thumbprint : string option;
+ vddk_transports : string option;
+ vddk_vimapiver : string option;
+}
+(** Various options passed through to the nbdkit vddk plugin unmodified. *)
+
+val input_libvirt_vddk : vddk_options -> string option -> string option ->
Xml.uri -> string -> Types.input
(** [input_libvirt_vddk vddk_options password libvirt_uri parsed_uri guest]
creates and returns a {!Types.input} object specialized for reading
the guest disks using the nbdkit vddk plugin. *)
diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
index 32615fa1f..b76a2e930 100644
--- a/v2v/output_vdsm.ml
+++ b/v2v/output_vdsm.ml
@@ -26,7 +26,7 @@ open Printf
open Types
open Utils
-type vdsm_params = {
+type vdsm_options = {
image_uuids : string list;
vol_uuids : string list;
vm_uuid : string;
@@ -35,22 +35,22 @@ type vdsm_params = {
ovf_flavour : Create_ovf.ovf_flavour;
}
-class output_vdsm os vdsm_params output_alloc =
+class output_vdsm os vdsm_options output_alloc =
object
inherit output
method as_options =
sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s%s" os
(String.concat ""
- (List.map (sprintf " --vdsm-image-uuid %s") vdsm_params.image_uuids))
+ (List.map (sprintf " --vdsm-image-uuid %s")
vdsm_options.image_uuids))
(String.concat ""
- (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_params.vol_uuids))
- vdsm_params.vm_uuid
- vdsm_params.ovf_output
- (match vdsm_params.compat with
+ (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_options.vol_uuids))
+ vdsm_options.vm_uuid
+ vdsm_options.ovf_output
+ (match vdsm_options.compat with
| "0.10" -> "" (* currently this is the default, so
don't print it *)
| s -> sprintf " --vdsm-compat=%s" s)
- (match vdsm_params.ovf_flavour with
+ (match vdsm_options.ovf_flavour with
| Create_ovf.OVirt -> "--vdsm-ovf-flavour=ovf"
(* currently this is the default, so don't print it *)
| Create_ovf.RHVExportStorageDomain -> "")
@@ -82,8 +82,8 @@ object
* displaying errors there.
*)
method prepare_targets _ targets =
- if List.length vdsm_params.image_uuids <> List.length targets ||
- List.length vdsm_params.vol_uuids <> List.length targets then
+ if List.length vdsm_options.image_uuids <> List.length targets ||
+ List.length vdsm_options.vol_uuids <> List.length targets then
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)")
(List.length targets);
@@ -111,14 +111,14 @@ object
if not (is_directory d) then
error (f_"image directory (%s) does not exist or is not a
directory")
d
- ) vdsm_params.image_uuids;
+ ) vdsm_options.image_uuids;
(* Note that VDSM has to create this directory too. *)
- if not (is_directory vdsm_params.ovf_output) then
+ if not (is_directory vdsm_options.ovf_output) then
error (f_"OVF (metadata) directory (%s) does not exist or is not a
directory")
- vdsm_params.ovf_output;
+ vdsm_options.ovf_output;
- debug "VDSM: OVF (metadata) directory: %s" vdsm_params.ovf_output;
+ debug "VDSM: OVF (metadata) directory: %s" vdsm_options.ovf_output;
(* The final directory structure should look like this:
* /<MP>/<ESD_UUID>/images/
@@ -140,12 +140,12 @@ object
debug "VDSM: will export %s to %s" ov_sd target_file;
{ t with target_file = TargetFile target_file }
- ) (List.combine3 targets vdsm_params.image_uuids vdsm_params.vol_uuids) in
+ ) (List.combine3 targets vdsm_options.image_uuids vdsm_options.vol_uuids) in
(* Generate the .meta files associated with each volume. *)
let metas =
Create_ovf.create_meta_files output_alloc dd_uuid
- vdsm_params.image_uuids targets in
+ vdsm_options.image_uuids targets in
List.iter (
fun ({ target_file }, meta) ->
let target_file =
@@ -166,7 +166,7 @@ object
* nodes cannot handle qcow2 v3 (RHBZ#1145582, RHBZ#1400205).
*)
let compat =
- if format <> "qcow2" then compat else Some vdsm_params.compat in
+ if format <> "qcow2" then compat else Some vdsm_options.compat in
g#disk_create ?backingfile ?backingformat ?preallocation ?compat
?clustersize path format size
@@ -178,13 +178,13 @@ object
(* Create the metadata. *)
let ovf = Create_ovf.create_ovf source targets guestcaps inspect
output_alloc dd_uuid
- vdsm_params.image_uuids
- vdsm_params.vol_uuids
- vdsm_params.vm_uuid
- vdsm_params.ovf_flavour in
+ vdsm_options.image_uuids
+ vdsm_options.vol_uuids
+ vdsm_options.vm_uuid
+ vdsm_options.ovf_flavour in
(* Write it to the metadata file. *)
- let file = vdsm_params.ovf_output // vdsm_params.vm_uuid ^ ".ovf" in
+ let file = vdsm_options.ovf_output // vdsm_options.vm_uuid ^ ".ovf" in
with_open_out file (fun chan -> DOM.doc_to_chan chan ovf)
end
diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli
index f7f6f59ee..6ed684638 100644
--- a/v2v/output_vdsm.mli
+++ b/v2v/output_vdsm.mli
@@ -18,7 +18,7 @@
(** [-o vdsm] target. *)
-type vdsm_params = {
+type vdsm_options = {
image_uuids : string list; (* --vdsm-image-uuid (multiple) *)
vol_uuids : string list; (* --vdsm-vol-uuid (multiple) *)
vm_uuid : string; (* --vdsm-vm-uuid *)
@@ -28,7 +28,7 @@ type vdsm_params = {
}
(** Miscellaneous extra command line parameters used by VDSM. *)
-val output_vdsm : string -> vdsm_params -> Types.output_allocation ->
Types.output
-(** [output_vdsm os rhev_params output_alloc] creates and
+val output_vdsm : string -> vdsm_options -> Types.output_allocation ->
Types.output
+(** [output_vdsm os vdsm_options output_alloc] creates and
returns a new {!Types.output} object specialized for writing
output to Data Domains directly under VDSM control. *)
diff --git a/v2v/types.ml b/v2v/types.ml
index c1f36fdb1..8c1a069e3 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -473,18 +473,6 @@ type root_choice = AskRoot | SingleRoot | FirstRoot | RootDev of
string
type output_allocation = Sparse | Preallocated
-type vddk_options = {
- vddk_config : string option;
- vddk_cookie : string option;
- vddk_libdir : string option;
- vddk_nfchostport : string option;
- vddk_port : string option;
- vddk_snapshot : string option;
- vddk_thumbprint : string option;
- vddk_transports : string option;
- vddk_vimapiver : string option;
-}
-
class virtual input = object
method precheck () = ()
method virtual as_options : string
diff --git a/v2v/types.mli b/v2v/types.mli
index a432e167c..c5f99a16b 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -339,19 +339,6 @@ type root_choice = AskRoot | SingleRoot | FirstRoot | RootDev of
string
type output_allocation = Sparse | Preallocated
(** Type of [-oa] (output allocation) option. *)
-type vddk_options = {
- vddk_config : string option;
- vddk_cookie : string option;
- vddk_libdir : string option;
- vddk_nfchostport : string option;
- vddk_port : string option;
- vddk_snapshot : string option;
- vddk_thumbprint : string option;
- vddk_transports : string option;
- vddk_vimapiver : string option;
-}
-(** Various options passed through to the nbdkit vddk plugin unmodified. *)
-
(** {2 Input object}
There is one of these used for the [-i] option. *)
--
2.13.2