|
|
498672 |
From 971f3c3239a9d6433fa351ceb983db9cce2ab4ac Mon Sep 17 00:00:00 2001
|
|
|
10436e |
From: Pino Toscano <ptoscano@redhat.com>
|
|
|
10436e |
Date: Fri, 27 Sep 2019 13:56:42 +0200
|
|
|
10436e |
Subject: [PATCH] v2v: -o rhv-upload: make -oo rhv-cafile optional
|
|
|
10436e |
|
|
|
10436e |
It makes little sense to require the oVirt certificate, especially when
|
|
|
10436e |
the verification of the connection (-oo rhv-verifypeer) is disabled by
|
|
|
10436e |
default. The only work done with the certificate in that case is
|
|
|
10436e |
checking that it is a valid certificate file.
|
|
|
10436e |
|
|
|
10436e |
Hence, make -oo rhv-cafile optional, requiring it only when
|
|
|
10436e |
-oo rhv-verifypeer is enabled.
|
|
|
10436e |
|
|
|
10436e |
(cherry picked from commit 0a5eaad7db3c9b9a03fa88102a9e6142c855bfd1)
|
|
|
10436e |
---
|
|
|
10436e |
v2v/output_rhv_upload.ml | 16 +++++++++-------
|
|
|
10436e |
v2v/virt-v2v-output-rhv.pod | 2 ++
|
|
|
10436e |
2 files changed, 11 insertions(+), 7 deletions(-)
|
|
|
10436e |
|
|
|
10436e |
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
|
|
|
10436e |
index 206657a2b..2c8c18732 100644
|
|
|
10436e |
--- a/v2v/output_rhv_upload.ml
|
|
|
10436e |
+++ b/v2v/output_rhv_upload.ml
|
|
|
10436e |
@@ -28,7 +28,7 @@ open Types
|
|
|
10436e |
open Utils
|
|
|
10436e |
|
|
|
10436e |
type rhv_options = {
|
|
|
10436e |
- rhv_cafile : string;
|
|
|
10436e |
+ rhv_cafile : string option;
|
|
|
10436e |
rhv_cluster : string option;
|
|
|
10436e |
rhv_direct : bool;
|
|
|
10436e |
rhv_verifypeer : bool;
|
|
|
10436e |
@@ -76,15 +76,13 @@ let parse_output_options options =
|
|
|
10436e |
error (f_"-o rhv-upload: unknown output option ‘-oo %s’") k
|
|
|
10436e |
) options;
|
|
|
10436e |
|
|
|
10436e |
- let rhv_cafile =
|
|
|
10436e |
- match !rhv_cafile with
|
|
|
10436e |
- | Some s -> s
|
|
|
10436e |
- | None ->
|
|
|
10436e |
- error (f_"-o rhv-upload: must use ‘-oo rhv-cafile’ to supply the path to the oVirt or RHV user’s ‘ca.pem’ file") in
|
|
|
10436e |
+ let rhv_cafile = !rhv_cafile in
|
|
|
10436e |
let rhv_cluster = !rhv_cluster in
|
|
|
10436e |
let rhv_direct = !rhv_direct in
|
|
|
10436e |
let rhv_verifypeer = !rhv_verifypeer in
|
|
|
10436e |
let rhv_disk_uuids = Option.map List.rev !rhv_disk_uuids in
|
|
|
10436e |
+ if rhv_verifypeer && rhv_cafile = None then
|
|
|
10436e |
+ error (f_"-o rhv-upload: must use ‘-oo rhv-cafile’ to supply the path to the oVirt or RHV user’s ‘ca.pem’ file");
|
|
|
10436e |
|
|
|
10436e |
{ rhv_cafile; rhv_cluster; rhv_direct; rhv_verifypeer; rhv_disk_uuids }
|
|
|
10436e |
|
|
|
10436e |
@@ -92,6 +90,10 @@ let nbdkit_python_plugin = Config.virt_v2v_nbdkit_python_plugin
|
|
|
10436e |
let pidfile_timeout = 30
|
|
|
10436e |
let finalization_timeout = 5*60
|
|
|
10436e |
|
|
|
10436e |
+let json_optstring = function
|
|
|
10436e |
+ | Some s -> JSON.String s
|
|
|
10436e |
+ | None -> JSON.Null
|
|
|
10436e |
+
|
|
|
10436e |
class output_rhv_upload output_alloc output_conn
|
|
|
10436e |
output_password output_storage
|
|
|
10436e |
rhv_options =
|
|
|
10436e |
@@ -200,7 +202,7 @@ See also the virt-v2v-output-rhv(1) manual.")
|
|
|
10436e |
"output_sparse", JSON.Bool (match output_alloc with
|
|
|
10436e |
| Sparse -> true
|
|
|
10436e |
| Preallocated -> false);
|
|
|
10436e |
- "rhv_cafile", JSON.String rhv_options.rhv_cafile;
|
|
|
10436e |
+ "rhv_cafile", json_optstring rhv_options.rhv_cafile;
|
|
|
10436e |
"rhv_cluster",
|
|
|
10436e |
JSON.String (Option.default "Default" rhv_options.rhv_cluster);
|
|
|
10436e |
"rhv_direct", JSON.Bool rhv_options.rhv_direct;
|
|
|
10436e |
diff --git a/v2v/virt-v2v-output-rhv.pod b/v2v/virt-v2v-output-rhv.pod
|
|
|
10436e |
index e840ca78d..04a894268 100644
|
|
|
10436e |
--- a/v2v/virt-v2v-output-rhv.pod
|
|
|
10436e |
+++ b/v2v/virt-v2v-output-rhv.pod
|
|
|
10436e |
@@ -101,6 +101,8 @@ The storage domain.
|
|
|
10436e |
The F<ca.pem> file (Certificate Authority), copied from
|
|
|
10436e |
F</etc/pki/ovirt-engine/ca.pem> on the oVirt engine.
|
|
|
10436e |
|
|
|
10436e |
+This option must be specified if I<-oo rhv-verifypeer> is enabled.
|
|
|
10436e |
+
|
|
|
10436e |
=item I<-oo rhv-cluster=>C<CLUSTERNAME>
|
|
|
10436e |
|
|
|
10436e |
Set the RHV Cluster Name. If not given it uses C<Default>.
|
|
|
10436e |
--
|
|
|
498672 |
2.18.4
|
|
|
10436e |
|