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

df3bb2
From ae2d0a507af53563d0b70d28654c9c60a857fd10 Mon Sep 17 00:00:00 2001
df3bb2
From: "Richard W.M. Jones" <rjones@redhat.com>
df3bb2
Date: Thu, 22 Feb 2018 11:43:33 +0000
df3bb2
Subject: [PATCH] v2v: Add -op (output password file) option.
df3bb2
df3bb2
Currently unused, in a future commit this will allow you to pass in a
df3bb2
password to be used when connecting to the target hypervisor.
df3bb2
df3bb2
(cherry picked from commit a4e181137a38f5767dd1bf05dc482959cb7283be)
df3bb2
---
df3bb2
 v2v/cmdline.ml       | 18 ++++++++++++++++++
df3bb2
 v2v/test-v2v-docs.sh |  2 +-
df3bb2
 v2v/virt-v2v.pod     |  7 +++++++
df3bb2
 3 files changed, 26 insertions(+), 1 deletion(-)
df3bb2
df3bb2
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
df3bb2
index 75909ee77..2a067741e 100644
df3bb2
--- a/v2v/cmdline.ml
df3bb2
+++ b/v2v/cmdline.ml
df3bb2
@@ -62,6 +62,7 @@ let parse_cmdline () =
df3bb2
   let output_conn = ref None in
df3bb2
   let output_format = ref None in
df3bb2
   let output_name = ref None in
df3bb2
+  let output_password = ref None in
df3bb2
   let output_storage = ref None in
df3bb2
   let password_file = ref None in
df3bb2
   let vddk_config = ref None in
df3bb2
@@ -219,6 +220,8 @@ let parse_cmdline () =
df3bb2
                                     s_"Set output format";
df3bb2
     [ M"on" ],       Getopt.String ("name", set_string_option_once "-on" output_name),
df3bb2
                                     s_"Rename guest when converting";
df3bb2
+    [ M"op" ],       Getopt.String ("filename", set_string_option_once "-op" output_password),
df3bb2
+                                    s_"Use password from file to connect to output hypervisor";
df3bb2
     [ M"os" ],       Getopt.String ("storage", set_string_option_once "-os" output_storage),
df3bb2
                                     s_"Set output storage location";
df3bb2
     [ L"password-file" ], Getopt.String ("file", set_string_option_once "--password-file" password_file),
df3bb2
@@ -314,6 +317,7 @@ read the man page virt-v2v(1).
df3bb2
   let output_format = !output_format in
df3bb2
   let output_mode = !output_mode in
df3bb2
   let output_name = !output_name in
df3bb2
+  let output_password = !output_password in
df3bb2
   let output_storage = !output_storage in
df3bb2
   let password_file = !password_file in
df3bb2
   let print_source = !print_source in
df3bb2
@@ -461,6 +465,8 @@ read the man page virt-v2v(1).
df3bb2
     | `Glance ->
df3bb2
       if output_conn <> None then
df3bb2
         error_option_cannot_be_used_in_output_mode "glance" "-oc";
df3bb2
+      if output_password <> None then
df3bb2
+        error_option_cannot_be_used_in_output_mode "glance" "-op";
df3bb2
       if output_storage <> None then
df3bb2
         error_option_cannot_be_used_in_output_mode "glance" "-os";
df3bb2
       if qemu_boot then
df3bb2
@@ -472,6 +478,8 @@ read the man page virt-v2v(1).
df3bb2
 
df3bb2
     | `Not_set
df3bb2
     | `Libvirt ->
df3bb2
+      if output_password <> None then
df3bb2
+        error_option_cannot_be_used_in_output_mode "libvirt" "-op";
df3bb2
       let output_storage = Option.default "default" output_storage in
df3bb2
       if qemu_boot then
df3bb2
         error_option_cannot_be_used_in_output_mode "libvirt" "--qemu-boot";
df3bb2
@@ -481,6 +489,8 @@ read the man page virt-v2v(1).
df3bb2
       output_format, output_alloc
df3bb2
 
df3bb2
     | `Local ->
df3bb2
+      if output_password <> None then
df3bb2
+        error_option_cannot_be_used_in_output_mode "local" "-op";
df3bb2
       let os =
df3bb2
         match output_storage with
df3bb2
         | None ->
df3bb2
@@ -500,6 +510,8 @@ read the man page virt-v2v(1).
df3bb2
         error_option_cannot_be_used_in_output_mode "null" "-oc";
df3bb2
       if output_format <> None then
df3bb2
         error_option_cannot_be_used_in_output_mode "null" "-of";
df3bb2
+      if output_password <> None then
df3bb2
+        error_option_cannot_be_used_in_output_mode "null" "-op";
df3bb2
       if output_storage <> None then
df3bb2
         error_option_cannot_be_used_in_output_mode "null" "-os";
df3bb2
       if qemu_boot then
df3bb2
@@ -509,6 +521,8 @@ read the man page virt-v2v(1).
df3bb2
       Some "raw", Sparse
df3bb2
 
df3bb2
     | `QEmu ->
df3bb2
+      if output_password <> None then
df3bb2
+        error_option_cannot_be_used_in_output_mode "qemu" "-op";
df3bb2
       let os =
df3bb2
         match output_storage with
df3bb2
         | None ->
df3bb2
@@ -520,6 +534,8 @@ read the man page virt-v2v(1).
df3bb2
       output_format, output_alloc
df3bb2
 
df3bb2
     | `RHV ->
df3bb2
+      if output_password <> None then
df3bb2
+        error_option_cannot_be_used_in_output_mode "rhv" "-op";
df3bb2
       let os =
df3bb2
         match output_storage with
df3bb2
         | None ->
df3bb2
@@ -531,6 +547,8 @@ read the man page virt-v2v(1).
df3bb2
       output_format, output_alloc
df3bb2
 
df3bb2
     | `VDSM ->
df3bb2
+      if output_password <> None then
df3bb2
+        error_option_cannot_be_used_in_output_mode "vdsm" "-op";
df3bb2
       let os =
df3bb2
         match output_storage with
df3bb2
         | None ->
df3bb2
diff --git a/v2v/test-v2v-docs.sh b/v2v/test-v2v-docs.sh
df3bb2
index 5d034c465..0e3bd916a 100755
df3bb2
--- a/v2v/test-v2v-docs.sh
df3bb2
+++ b/v2v/test-v2v-docs.sh
df3bb2
@@ -22,4 +22,4 @@ $TEST_FUNCTIONS
df3bb2
 skip_if_skipped
df3bb2
 
df3bb2
 $top_srcdir/podcheck.pl virt-v2v.pod virt-v2v \
df3bb2
-  --ignore=--debug-overlay,--ic,--if,--it,--no-trim,--oa,--oc,--of,--on,--os,--vmtype
df3bb2
+  --ignore=--debug-overlay,--ic,--if,--it,--no-trim,--oa,--oc,--of,--on,--op,--os,--vmtype
df3bb2
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
df3bb2
index 0ea5fa97f..00ba45555 100644
df3bb2
--- a/v2v/virt-v2v.pod
df3bb2
+++ b/v2v/virt-v2v.pod
df3bb2
@@ -569,6 +569,13 @@ If not specified, then the input format is used.
df3bb2
 Rename the guest when converting it.  If this option is not used then
df3bb2
 the output name is the same as the input name.
df3bb2
 
df3bb2
+=item B<-op> file
df3bb2
+
df3bb2
+Supply a file containing a password to be used when connecting to the
df3bb2
+target hypervisor.  Note the file should contain the whole password,
df3bb2
+B<without any trailing newline>, and for security the file should have
df3bb2
+mode C<0600> so that others cannot read it.
df3bb2
+
df3bb2
 =item B<-os> storage
df3bb2
 
df3bb2
 The location of the storage for the converted guest.
df3bb2
-- 
df3bb2
2.21.0
df3bb2