[Pkg-libvirt-commits] [libguestfs] 83/266: v2v: Combine miscellaneous RHEV command line options into a single structure.
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 3 14:41:45 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag debian/1%1.27.35-1
in repository libguestfs.
commit ba63916960d8ddb318b1a15872d2f142e0e719b6
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Tue Aug 12 15:26:38 2014 +0100
v2v: Combine miscellaneous RHEV command line options into a single structure.
At the moment there is just one "miscellaneous RHEV command line
option" (--vmtype), but we may add more in future. Put them in a
single struct for convenience.
This is just code motion.
---
v2v/cmdline.ml | 3 ++-
v2v/target_RHEV.ml | 6 +++---
v2v/target_RHEV.mli | 11 ++++++-----
v2v/types.ml | 6 +++++-
v2v/types.mli | 7 ++++++-
v2v/v2v.ml | 9 +++++----
6 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
index 730c936..fe99f17 100644
--- a/v2v/cmdline.ml
+++ b/v2v/cmdline.ml
@@ -201,7 +201,8 @@ read the man page virt-v2v(1).
| `RHEV ->
if output_storage = "" then
error (f_"-o rhev: output storage was not specified, use '-os'");
- OutputRHEV (output_storage, vmtype) in
+ let rhev_params = { vmtype = vmtype } in
+ OutputRHEV (output_storage, rhev_params) in
input, output,
debug_gc, output_alloc, output_format, output_name,
diff --git a/v2v/target_RHEV.ml b/v2v/target_RHEV.ml
index d3f360d..d34827b 100644
--- a/v2v/target_RHEV.ml
+++ b/v2v/target_RHEV.ml
@@ -70,7 +70,7 @@ let iso_time =
* done the conversion and copy, and the user won't thank us for
* displaying errors there.
*)
-let rec initialize ~verbose os source output_alloc overlays =
+let rec initialize ~verbose os rhev_params source output_alloc overlays =
esd := mount_and_check_export_storage_domain ~verbose os;
if verbose then
eprintf "RHEV: ESD mountpoint: %s\nRHEV: ESD UUID: %s\n%!" !esd.mp !esd.uuid;
@@ -243,14 +243,14 @@ and check_export_storage_domain os mp =
{ mp = mp; uuid = uuid }
(* This is called after conversion to write the OVF metadata. *)
-let rec create_metadata os vmtype source output_alloc
+let rec create_metadata os rhev_params source output_alloc
overlays inspect guestcaps =
let vm_uuid = uuidgen ~prog () in
let memsize_mb = source.s_memory /^ 1024L /^ 1024L in
let vmtype =
- match vmtype with
+ match rhev_params.vmtype with
| Some vmtype -> vmtype
| None -> get_vmtype inspect in
let vmtype = match vmtype with `Desktop -> "DESKTOP" | `Server -> "SERVER" in
diff --git a/v2v/target_RHEV.mli b/v2v/target_RHEV.mli
index 6cc5c76..b8542ea 100644
--- a/v2v/target_RHEV.mli
+++ b/v2v/target_RHEV.mli
@@ -16,9 +16,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
-val initialize : verbose:bool -> string -> Types.source ->
- [`Sparse | `Preallocated] -> Types.overlay list -> Types.overlay list
+val initialize : verbose:bool -> string -> Types.output_rhev_params ->
+ Types.source -> [`Sparse | `Preallocated] ->
+ Types.overlay list -> Types.overlay list
-val create_metadata : string -> [`Server | `Desktop] option -> Types.source ->
- [`Sparse | `Preallocated] -> Types.overlay list -> Types.inspect ->
- Types.guestcaps -> unit
+val create_metadata : string -> Types.output_rhev_params ->
+ Types.source -> [`Sparse | `Preallocated] -> Types.overlay list ->
+ Types.inspect -> Types.guestcaps -> unit
diff --git a/v2v/types.ml b/v2v/types.ml
index 05aafb1..ecb4b35 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -27,7 +27,11 @@ type input =
type output =
| OutputLibvirt of string option
| OutputLocal of string
-| OutputRHEV of string * [`Server|`Desktop] option
+| OutputRHEV of string * output_rhev_params
+
+and output_rhev_params = {
+ vmtype : [`Server|`Desktop] option;
+}
type source = {
s_dom_type : string;
diff --git a/v2v/types.mli b/v2v/types.mli
index 0415a27..8ba47fe 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -26,9 +26,14 @@ type input =
type output =
| OutputLibvirt of string option (* -o libvirt: -oc *)
| OutputLocal of string (* -o local: directory *)
-| OutputRHEV of string * [`Server|`Desktop] option (* -o rhev: output storage *)
+| OutputRHEV of string * output_rhev_params (* -o rhev: output storage *)
(** The output arguments as specified on the command line. *)
+and output_rhev_params = {
+ vmtype : [`Server|`Desktop] option; (* --vmtype *)
+}
+(** Miscellaneous extra command line parameters used by RHEV. *)
+
type source = {
s_dom_type : string; (** Source domain type, eg "kvm" *)
s_name : string; (** Guest name. *)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 6f36a22..9989643 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -197,8 +197,8 @@ let rec main () =
| OutputLibvirt oc -> assert false
| OutputLocal dir ->
Target_local.create_metadata dir renamed_source overlays guestcaps
- | OutputRHEV (os, vmtype) ->
- Target_RHEV.create_metadata os vmtype renamed_source output_alloc
+ | OutputRHEV (os, rhev_params) ->
+ Target_RHEV.create_metadata os rhev_params renamed_source output_alloc
overlays inspect guestcaps in
(* If we wrote to a temporary file, rename to the real file. *)
@@ -257,8 +257,9 @@ and initialize_target ~verbose g
match output with
| OutputLibvirt oc -> assert false
| OutputLocal dir -> Target_local.initialize dir renamed_source overlays
- | OutputRHEV (os, _) ->
- Target_RHEV.initialize ~verbose os renamed_source output_alloc overlays in
+ | OutputRHEV (os, rhev_params) ->
+ Target_RHEV.initialize ~verbose
+ os rhev_params renamed_source output_alloc overlays in
overlays
and inspect_source g root_choice =
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list