Blame SOURCES/0047-v2v-Cope-with-libvirt-vpx-esx-driver-which-does-not-.patch

61e9b3
From 992af0707ad54d39ec707da6daa6c4ca7c3fc69a Mon Sep 17 00:00:00 2001
61e9b3
From: "Richard W.M. Jones" <rjones@redhat.com>
61e9b3
Date: Wed, 24 Nov 2021 11:23:38 +0000
61e9b3
Subject: [PATCH] v2v: Cope with libvirt vpx/esx driver which does not set
61e9b3
 format
61e9b3
61e9b3
See discussion in this bug:
61e9b3
https://bugzilla.redhat.com/show_bug.cgi?id=2026199
61e9b3
61e9b3
Fixes: commit 40cfe6da0861ca6360f670e254c71ed923a0402f
61e9b3
(cherry picked from commit 59dc3293a9b4fdf11da8571c50e3e5badbb511c2)
61e9b3
---
61e9b3
 v2v/parse_libvirt_xml.ml | 8 ++++++--
61e9b3
 1 file changed, 6 insertions(+), 2 deletions(-)
61e9b3
61e9b3
diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml
61e9b3
index 27e08135..e65fbf4a 100644
61e9b3
--- a/v2v/parse_libvirt_xml.ml
61e9b3
+++ b/v2v/parse_libvirt_xml.ml
61e9b3
@@ -273,7 +273,11 @@ let parse_libvirt_xml ?bandwidth ?conn xml =
61e9b3
         | Some "aio" -> "raw" (* Xen wierdness *)
61e9b3
         | Some format -> format
61e9b3
         | None ->
61e9b3
-           error (f_"<disk><driver type=\"format\"> attribute is missing from the libvirt XML") in
61e9b3
+           (* Some libvirt drivers don't set the format.  Typically
61e9b3
+            * this is the vpx/esx driver (see RHBZ#2026199).  We
61e9b3
+            * can assume "raw", as it will be overwritten later.
61e9b3
+            *)
61e9b3
+           "raw" in
61e9b3
 
61e9b3
       (* The <disk type='...'> attribute may be 'block', 'file',
61e9b3
        * 'network' or 'volume'.  We ignore any other types.
61e9b3
@@ -344,7 +348,7 @@ let parse_libvirt_xml ?bandwidth ?conn xml =
61e9b3
             match xpath_string "/volume/target/format/@type" with
61e9b3
             | Some format -> format
61e9b3
             | None ->
61e9b3
-               error (f_"<volume><target>.<format type=\"format\"> attribute is missing from the libvirt XML of volume %s") vol in
61e9b3
+               error (f_"<volume><target><format type=\"format\"> attribute is missing from the libvirt XML of volume %s") vol in
61e9b3
 
61e9b3
           (match xpath_string "/volume/@type" with
61e9b3
           | None | Some "file" ->
61e9b3
-- 
8984ae
2.31.1
61e9b3