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