virt-v2v obviously cannot convert this kind of devices, since they are
specific to the host of the hypervisor. Thus, emit a warning about the
presence of passthrough host devices, so at least this can be noticed
when converting a guest.
---
v2v/parse_libvirt_xml.ml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml
index 84c5d4fc7..c71707000 100644
--- a/v2v/parse_libvirt_xml.ml
+++ b/v2v/parse_libvirt_xml.ml
@@ -460,6 +460,22 @@ let parse_libvirt_xml ?conn xml =
done;
List.rev !nics in
+ (* Check for hostdev devices. (RHBZ#1472719) *)
+ let () =
+ let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/hostdev" in
+ let nr_nodes = Xml.xpathobj_nr_nodes obj in
+ if nr_nodes > 0 then (
+ (* Sadly fn_ in ocaml-gettext seems broken, and always returns the
+ * singular string no matter what. Work around this by using a simple
+ * string with sn_ (which works), and outputting it as a whole.
+ *)
+ let msg = sn_ "this guest has a passthrough host device which will be
ignored"
+ "this guest has passthrough host devices which will be
ignored"
+ nr_nodes in
+ warning "%s" msg
+ )
+ in
+
({
s_hypervisor = hypervisor;
s_name = name; s_orig_name = name;
--
2.13.5