Pino Toscano
2018-Jul-17 15:14 UTC
[Libguestfs] [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.17.1
Richard W.M. Jones
2018-Jul-17 15:31 UTC
Re: [Libguestfs] [PATCH] v2v: -o rhv-upload: check for ovirtsdk4 (RHBZ#1601943)
On Tue, Jul 17, 2018 at 05:14:44PM +0200, Pino Toscano wrote:> 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 ();ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Maybe Matching Threads
- [PATCH 0/8] v2v: various fixed for -o rhv-upload
- [PATCH v9] v2v: Add -o rhv-upload output mode (RHBZ#1557273).
- [PATCH 0/3] v2v: -o rhv-upload: Add a test.
- [PATCH 1/8] v2v: -o rhv-upload: split vmcheck out of precheck
- [PATCH v2 0/3] v2v: -o rhv-upload: Add a test.