[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 09/14] v2v: When parsing input libvirt XML, get correct disk image format.



Old Xen PV guests had:

      <driver name='tap' type='aio'/>

The previous xpath expression matched any driver type attribute in
order to pick up the format.  However we only want to match:

      <driver name='qemu' type='raw'/>

so we need to check the name attribute as well.
---
 v2v/source_libvirt.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/v2v/source_libvirt.ml b/v2v/source_libvirt.ml
index 520b1e3..4a3c9f1 100644
--- a/v2v/source_libvirt.ml
+++ b/v2v/source_libvirt.ml
@@ -95,7 +95,7 @@ let create_xml ?dir xml =
       Xml.xpathctx_set_current_context xpathctx node;
 
       let format =
-        let format = xpath_to_string "driver/@type" "" in
+        let format = xpath_to_string "driver[name='qemu']/@type" "" in
         if format <> "" then Some format else None in
 
       (* The <disk type='...'> attribute may be 'block', 'file' or
-- 
1.9.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]