From 0c295c8e23a90d3a3f5efcfa0452ecde7317e122 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 4 Sep 2014 12:37:12 +0100 Subject: [PATCH] v2v: -i libvirtxml: Detect disk format using any field. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously we only looked for . However for Xen imports, the name field could be name=tap (or other values in fact). Since there can only be one element under , look for any in order to get the disk format. A further complication for Xen is that type=aio means "raw" (for obscure historical reasons), so map that. Thanks: Dan Berrangé. --- v2v/input_libvirtxml.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml index 730ed0ac1..b9c1a87b5 100644 --- a/v2v/input_libvirtxml.ml +++ b/v2v/input_libvirtxml.ml @@ -129,8 +129,10 @@ let parse_libvirt_xml ?(map_source_file = no_map) ?(map_source_dev = no_map) if target_dev <> "" then Some target_dev else None in let format = - let format = xpath_to_string "driver[@name='qemu']/@type" "" in - if format <> "" then Some format else None in + match xpath_to_string "driver/@type" "" with + | "aio" -> Some "raw" (* Xen wierdness *) + | "" -> None + | format -> Some format in (* The attribute may be 'block', 'file' or * 'network'. We ignore any other types.