libguestfs/SOURCES/0036-v2v-o-rhv-upload-check-for-ovirtsdk4-RHBZ-1601943.patch

41 lines
1.4 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From bb6b81861e72535f57bdc8e9a3457807f21ad28c Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 17 Jul 2018 17:12:38 +0200
Subject: [PATCH] v2v: -o rhv-upload: check for ovirtsdk4 (RHBZ#1601943)
Check earlier whether the ovirtsdk4 Python can be imported correctly,
to avoid errors later on during the migration.
---
v2v/output_rhv_upload.ml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
index 0152b8d5a..63fa2411a 100644
--- a/v2v/output_rhv_upload.ml
+++ b/v2v/output_rhv_upload.ml
@@ -126,6 +126,13 @@ class output_rhv_upload output_alloc output_conn
python3
in
+ (* Check that the 'ovirtsdk4' Python module is available. *)
+ let error_unless_ovirtsdk4_module_available () =
+ let res = run_command [ python3; "-c"; "import ovirtsdk4" ] in
+ if res <> 0 then
+ error (f_"the Python module ovirtsdk4 could not be loaded, is it installed? See previous messages for problems.")
+ in
+
(* Check that nbdkit is available and new enough. *)
let error_unless_nbdkit_working () =
if 0 <> Sys.command "nbdkit --version >/dev/null" then
@@ -231,6 +238,7 @@ object
method precheck () =
error_unless_python_binary_on_path ();
+ error_unless_ovirtsdk4_module_available ();
error_unless_nbdkit_working ();
error_unless_nbdkit_python3_working ();
error_unless_output_alloc_sparse ();
--
2.21.0