Blame SOURCES/0045-v2v-vddk-Print-passthrough-options.patch

a30de4
From e94aedc6fc64f255ab1fa2fcd31f78e86c28c5de Mon Sep 17 00:00:00 2001
a30de4
From: "Richard W.M. Jones" <rjones@redhat.com>
a30de4
Date: Mon, 16 Oct 2017 14:32:28 +0100
a30de4
Subject: [PATCH] v2v: vddk: Print passthrough options.
a30de4
a30de4
Changes the output to look like:
a30de4
a30de4
[   0.0] Opening the source -i libvirt -ic vpx://... guestname --vddk ... --vddk-thumbprint ...
a30de4
a30de4
(cherry picked from commit ce2aa47d1d79223c1a7a49b3f41e09078f22f554)
a30de4
---
a30de4
 v2v/input_libvirt_vddk.ml | 42 ++++++++++++++++++++++++++++++++----------
a30de4
 1 file changed, 32 insertions(+), 10 deletions(-)
a30de4
a30de4
diff --git a/v2v/input_libvirt_vddk.ml b/v2v/input_libvirt_vddk.ml
a30de4
index 89d2552f6..b322a9c49 100644
a30de4
--- a/v2v/input_libvirt_vddk.ml
a30de4
+++ b/v2v/input_libvirt_vddk.ml
a30de4
@@ -101,8 +101,34 @@ See also \"INPUT FROM VDDK\" in the virt-v2v(1) manual.") library_path
a30de4
       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.")
a30de4
   in
a30de4
 
a30de4
+  (* List of passthrough parameters. *)
a30de4
+  let vddk_passthrus =
a30de4
+    [ "config",      (fun { vddk_config }      -> vddk_config);
a30de4
+      "cookie",      (fun { vddk_cookie }      -> vddk_cookie);
a30de4
+      "nfchostport", (fun { vddk_nfchostport } -> vddk_nfchostport);
a30de4
+      "port",        (fun { vddk_port }        -> vddk_port);
a30de4
+      "snapshot",    (fun { vddk_snapshot }    -> vddk_snapshot);
a30de4
+      "thumbprint",  (fun { vddk_thumbprint }  -> vddk_thumbprint);
a30de4
+      "transports",  (fun { vddk_transports }  -> vddk_transports);
a30de4
+      "vimapiver",   (fun { vddk_vimapiver }   -> vddk_vimapiver) ] in
a30de4
+
a30de4
 object
a30de4
-  inherit input_libvirt password libvirt_uri guest
a30de4
+  inherit input_libvirt password libvirt_uri guest as super
a30de4
+
a30de4
+  method as_options =
a30de4
+    let pt_options =
a30de4
+      String.concat "" (
a30de4
+        List.map (
a30de4
+          fun (name, get_field) ->
a30de4
+            match get_field vddk_options with
a30de4
+            | None -> ""
a30de4
+            | Some field -> sprintf " --vddk-%s %s" name field
a30de4
+        ) vddk_passthrus
a30de4
+      ) in
a30de4
+    sprintf "%s --vddk %s%s"
a30de4
+            super#as_options (* superclass prints "-i libvirt etc" *)
a30de4
+            vddk_options.vddk_libdir
a30de4
+            pt_options
a30de4
 
a30de4
   method source () =
a30de4
     error_unless_vddk_libdir ();
a30de4
@@ -209,15 +235,11 @@ object
a30de4
       add_arg (sprintf "libdir=%s" libdir);
a30de4
 
a30de4
       (* The passthrough parameters. *)
a30de4
-      let pt name = may (fun field -> add_arg (sprintf "%s=%s" name field)) in
a30de4
-      pt "config" vddk_options.vddk_config;
a30de4
-      pt "cookie" vddk_options.vddk_cookie;
a30de4
-      pt "nfchostport" vddk_options.vddk_nfchostport;
a30de4
-      pt "port" vddk_options.vddk_port;
a30de4
-      pt "snapshot" vddk_options.vddk_snapshot;
a30de4
-      pt "thumbprint" vddk_options.vddk_thumbprint;
a30de4
-      pt "transports" vddk_options.vddk_transports;
a30de4
-      pt "vimapiver" vddk_options.vddk_vimapiver;
a30de4
+      List.iter (
a30de4
+        fun (name, get_field) ->
a30de4
+          may (fun field -> add_arg (sprintf "%s=%s" name field))
a30de4
+              (get_field vddk_options)
a30de4
+      ) vddk_passthrus;
a30de4
 
a30de4
       get_args () in
a30de4
 
a30de4
-- 
a30de4
2.14.3
a30de4