[Pkg-libvirt-commits] [libguestfs] 109/266: v2v: Display message when intializing the target.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:48 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 8ba605cad0700a7907ec6ba98a6740c071e74b43
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Fri Aug 15 14:35:14 2014 +0100

    v2v: Display message when intializing the target.
    
    As initializing the target (-o ...) is a distinct operation, which can
    fail if the user supplied the wrong command line arguments, make sure
    we display an explicit message before we perform this step.
    
    It prints something like this:
    
      [   5.0] Initializing the target -o libvirt -os default
---
 v2v/types.ml  | 20 ++++++++++++++++++++
 v2v/types.mli |  3 +++
 v2v/v2v.ml    |  1 +
 3 files changed, 24 insertions(+)

diff --git a/v2v/types.ml b/v2v/types.ml
index 7c1c937..aeea221 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -36,6 +36,26 @@ and output_rhev_params = {
   vmtype : [`Server|`Desktop] option;
 }
 
+let output_as_options = function
+  | OutputLibvirt (None, os) ->
+    sprintf "-o libvirt -os %s" os
+  | OutputLibvirt (Some uri, os) ->
+    sprintf "-o libvirt -oc %s -os %s" uri os
+  | OutputLocal os ->
+    sprintf "-o local -os %s" os
+  | OutputRHEV (os, params) ->
+    sprintf "-o rhev -os %s%s%s%s%s" os
+      (match params.image_uuid with
+      | None -> "" | Some uuid -> sprintf " --rhev-image-uuid %s" uuid)
+      (String.concat ""
+         (List.map (sprintf " --rhev-vol-uuid %s") params.vol_uuids))
+      (match params.vm_uuid with
+      | None -> "" | Some uuid -> sprintf " --rhev-vm-uuid %s" uuid)
+      (match params.vmtype with
+      | None -> ""
+      | Some `Server -> " --vmtype server"
+      | Some `Desktop -> " --vmtype desktop")
+
 type source = {
   s_dom_type : string;
   s_name : string;
diff --git a/v2v/types.mli b/v2v/types.mli
index 6593c90..a772ce3 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -37,6 +37,9 @@ and output_rhev_params = {
 }
 (** Miscellaneous extra command line parameters used by RHEV. *)
 
+val output_as_options : output -> string
+(** Converts the output struct into the equivalent command line options. *)
+
 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 2a9d944..1e12af7 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -92,6 +92,7 @@ let rec main () =
    * just so we can display errors to the user before doing too much
    * work.
    *)
+  msg (f_"Initializing the target %s") (output_as_options output);
   let overlays =
     initialize_target ~verbose g
       source output output_alloc output_format output_name overlays in

-- 
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