Blame SOURCES/0034-v2v-Add-op-output-password-file-option.patch

97ae69
From 2d80f9e648fc4c7598f77dc0c15faeaacf63137d Mon Sep 17 00:00:00 2001
97ae69
From: "Richard W.M. Jones" <rjones@redhat.com>
97ae69
Date: Thu, 22 Feb 2018 11:43:33 +0000
97ae69
Subject: [PATCH] v2v: Add -op (output password file) option.
97ae69
97ae69
Currently unused, in a future commit this will allow you to pass in a
97ae69
password to be used when connecting to the target hypervisor.
97ae69
97ae69
(cherry picked from commit a4e181137a38f5767dd1bf05dc482959cb7283be)
97ae69
---
97ae69
 v2v/cmdline.ml       | 18 ++++++++++++++++++
97ae69
 v2v/test-v2v-docs.sh |  2 +-
97ae69
 v2v/virt-v2v.pod     |  7 +++++++
97ae69
 3 files changed, 26 insertions(+), 1 deletion(-)
97ae69
97ae69
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
97ae69
index e80b0689b..bfdc250fc 100644
97ae69
--- a/v2v/cmdline.ml
97ae69
+++ b/v2v/cmdline.ml
97ae69
@@ -62,6 +62,7 @@ let parse_cmdline () =
97ae69
   let output_conn = ref None in
97ae69
   let output_format = ref None in
97ae69
   let output_name = ref None in
97ae69
+  let output_password = ref None in
97ae69
   let output_storage = ref None in
97ae69
   let password_file = ref None in
97ae69
   let vddk_config = ref None in
97ae69
@@ -218,6 +219,8 @@ let parse_cmdline () =
97ae69
                                     s_"Set output format";
97ae69
     [ M"on" ],       Getopt.String ("name", set_string_option_once "-on" output_name),
97ae69
                                     s_"Rename guest when converting";
97ae69
+    [ M"op" ],       Getopt.String ("filename", set_string_option_once "-op" output_password),
97ae69
+                                    s_"Use password from file to connect to output hypervisor";
97ae69
     [ M"os" ],       Getopt.String ("storage", set_string_option_once "-os" output_storage),
97ae69
                                     s_"Set output storage location";
97ae69
     [ L"password-file" ], Getopt.String ("file", set_string_option_once "--password-file" password_file),
97ae69
@@ -312,6 +315,7 @@ read the man page virt-v2v(1).
97ae69
   let output_format = !output_format in
97ae69
   let output_mode = !output_mode in
97ae69
   let output_name = !output_name in
97ae69
+  let output_password = !output_password in
97ae69
   let output_storage = !output_storage in
97ae69
   let password_file = !password_file in
97ae69
   let print_source = !print_source in
97ae69
@@ -462,6 +466,8 @@ read the man page virt-v2v(1).
97ae69
     | `Glance ->
97ae69
       if output_conn <> None then
97ae69
         error_option_cannot_be_used_in_output_mode "glance" "-oc";
97ae69
+      if output_password <> None then
97ae69
+        error_option_cannot_be_used_in_output_mode "glance" "-op";
97ae69
       if output_storage <> None then
97ae69
         error_option_cannot_be_used_in_output_mode "glance" "-os";
97ae69
       if qemu_boot then
97ae69
@@ -473,6 +479,8 @@ read the man page virt-v2v(1).
97ae69
 
97ae69
     | `Not_set
97ae69
     | `Libvirt ->
97ae69
+      if output_password <> None then
97ae69
+        error_option_cannot_be_used_in_output_mode "libvirt" "-op";
97ae69
       let output_storage = Option.default "default" output_storage in
97ae69
       if qemu_boot then
97ae69
         error_option_cannot_be_used_in_output_mode "libvirt" "--qemu-boot";
97ae69
@@ -482,6 +490,8 @@ read the man page virt-v2v(1).
97ae69
       output_format, output_alloc
97ae69
 
97ae69
     | `Local ->
97ae69
+      if output_password <> None then
97ae69
+        error_option_cannot_be_used_in_output_mode "local" "-op";
97ae69
       let os =
97ae69
         match output_storage with
97ae69
         | None ->
97ae69
@@ -501,6 +511,8 @@ read the man page virt-v2v(1).
97ae69
         error_option_cannot_be_used_in_output_mode "null" "-oc";
97ae69
       if output_format <> None then
97ae69
         error_option_cannot_be_used_in_output_mode "null" "-of";
97ae69
+      if output_password <> None then
97ae69
+        error_option_cannot_be_used_in_output_mode "null" "-op";
97ae69
       if output_storage <> None then
97ae69
         error_option_cannot_be_used_in_output_mode "null" "-os";
97ae69
       if qemu_boot then
97ae69
@@ -510,6 +522,8 @@ read the man page virt-v2v(1).
97ae69
       Some "raw", Sparse
97ae69
 
97ae69
     | `QEmu ->
97ae69
+      if output_password <> None then
97ae69
+        error_option_cannot_be_used_in_output_mode "qemu" "-op";
97ae69
       let os =
97ae69
         match output_storage with
97ae69
         | None ->
97ae69
@@ -523,6 +537,8 @@ read the man page virt-v2v(1).
97ae69
       output_format, output_alloc
97ae69
 
97ae69
     | `RHV ->
97ae69
+      if output_password <> None then
97ae69
+        error_option_cannot_be_used_in_output_mode "rhv" "-op";
97ae69
       let os =
97ae69
         match output_storage with
97ae69
         | None ->
97ae69
@@ -534,6 +550,8 @@ read the man page virt-v2v(1).
97ae69
       output_format, output_alloc
97ae69
 
97ae69
     | `VDSM ->
97ae69
+      if output_password <> None then
97ae69
+        error_option_cannot_be_used_in_output_mode "vdsm" "-op";
97ae69
       let os =
97ae69
         match output_storage with
97ae69
         | None ->
97ae69
diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh
97ae69
index c8ca193eb..bb1ddefd7 100755
97ae69
--- a/v2v/test-v2v-docs.sh
97ae69
+++ b/v2v/test-v2v-docs.sh
97ae69
@@ -22,4 +22,4 @@ $TEST_FUNCTIONS
97ae69
 skip_if_skipped
97ae69
 
97ae69
 $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
97ae69
-  --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
97ae69
+  --ignore=--debug-overlay,--ic,--if,--in-place,--it,--no-trim,--oa,--oc,--of,--on,--op,--os,--vmtype
97ae69
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
97ae69
index d81a2339c..4df3791a9 100644
97ae69
--- a/v2v/virt-v2v.pod
97ae69
+++ b/v2v/virt-v2v.pod
97ae69
@@ -442,6 +442,13 @@ If not specified, then the input format is used.
97ae69
 Rename the guest when converting it.  If this option is not used then
97ae69
 the output name is the same as the input name.
97ae69
 
97ae69
+=item B<-op> file
97ae69
+
97ae69
+Supply a file containing a password to be used when connecting to the
97ae69
+target hypervisor.  Note the file should contain the whole password,
97ae69
+B<without any trailing newline>, and for security the file should have
97ae69
+mode C<0600> so that others cannot read it.
97ae69
+
97ae69
 =item B<-os> storage
97ae69
 
97ae69
 The location of the storage for the converted guest.
97ae69
-- 
97ae69
2.17.1
97ae69