[Libguestfs] [PATCH v2 3/3] v2v: Improve handling when one of the input disks is blank (RHBZ#1232192).

Richard W.M. Jones rjones at redhat.com
Thu Jun 18 09:21:50 UTC 2015


In commit 4c73d1d4f142c6f6211c963beea68773e11fd3ef, I changed the
behaviour of virt-v2v so it ignores all errors from the
g#part_get_parttype method.  However that would ignore I/O errors and
similar.

Only ignore the "unrecognised disk label" error from parted, by
testing if the return code is EINVAL.

This fixes commit 4c73d1d4f142c6f6211c963beea68773e11fd3ef.
---
 v2v/v2v.ml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 3f49f68..418c836 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -555,7 +555,9 @@ and inspect_source g root_choice =
       g#part_get_gpt_type dev (Int32.to_int partnum) = uefi_ESP_guid
     and parttype_is_gpt dev =
       try g#part_get_parttype dev = "gpt"
-      with G.Error msg ->
+      with G.Error msg as exn ->
+        (* If it's _not_ "unrecognised disk label" then re-raise it. *)
+        if g#last_errno () <> G.Errno.errno_EINVAL then raise exn;
         if verbose () then printf "%s (ignored)\n" msg;
         false
     and is_uefi_bootable_device dev =
-- 
2.3.1




More information about the Libguestfs mailing list