v2v: -i libvirtxml: Detect disk format using any <driver type=...> field.

Previously we only looked for <driver name=qemu type=...>.  However
for Xen imports, the name field could be name=tap (or other values in
fact).  Since there can only be one <driver/> element under <disk/>,
look for any <driver type=...> 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é.
This commit is contained in:
Richard W.M. Jones
2014-09-04 12:37:12 +01:00
parent 27a5ef9131
commit 0c295c8e23

View File

@@ -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 <disk type='...'> attribute may be 'block', 'file' or
* 'network'. We ignore any other types.