|
|
498672 |
From 573f551ff8ced48f4ea21ec7bbbad235092f36f2 Mon Sep 17 00:00:00 2001
|
|
|
10436e |
From: Pino Toscano <ptoscano@redhat.com>
|
|
|
10436e |
Date: Fri, 12 Apr 2019 17:28:12 +0200
|
|
|
10436e |
Subject: [PATCH] v2v: warn when the guest has direct network interfaces
|
|
|
10436e |
(RHBZ#1518539)
|
|
|
10436e |
|
|
|
10436e |
virt-v2v obviously cannot convert this kind of devices, since they are
|
|
|
10436e |
specific to the host of the hypervisor. Thus, emit a warning about the
|
|
|
10436e |
presence of direct network interfaces, so at least this can be noticed
|
|
|
10436e |
when converting a guest.
|
|
|
10436e |
|
|
|
10436e |
(cherry picked from commit 1629ec6a5639cf5e226e80bcee749ae8851b1fae)
|
|
|
10436e |
---
|
|
|
10436e |
v2v/parse_libvirt_xml.ml | 18 ++++++++++++++++++
|
|
|
10436e |
1 file changed, 18 insertions(+)
|
|
|
10436e |
|
|
|
10436e |
diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml
|
|
|
10436e |
index d5d78d367..b9970cee8 100644
|
|
|
10436e |
--- a/v2v/parse_libvirt_xml.ml
|
|
|
10436e |
+++ b/v2v/parse_libvirt_xml.ml
|
|
|
10436e |
@@ -492,6 +492,24 @@ let parse_libvirt_xml ?conn xml =
|
|
|
10436e |
)
|
|
|
10436e |
in
|
|
|
10436e |
|
|
|
10436e |
+ (* Check for direct attachments to physical network interfaces.
|
|
|
10436e |
+ * (RHBZ#1518539)
|
|
|
10436e |
+ *)
|
|
|
10436e |
+ let () =
|
|
|
10436e |
+ let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/interface[@type='direct']" in
|
|
|
10436e |
+ let nr_nodes = Xml.xpathobj_nr_nodes obj in
|
|
|
10436e |
+ if nr_nodes > 0 then (
|
|
|
10436e |
+ (* Sadly fn_ in ocaml-gettext seems broken, and always returns the
|
|
|
10436e |
+ * singular string no matter what. Work around this by using a simple
|
|
|
10436e |
+ * string with sn_ (which works), and outputting it as a whole.
|
|
|
10436e |
+ *)
|
|
|
10436e |
+ let msg = sn_ "this guest has a direct network interface which will be ignored"
|
|
|
10436e |
+ "this guest has direct network interfaces which will be ignored"
|
|
|
10436e |
+ nr_nodes in
|
|
|
10436e |
+ warning "%s" msg
|
|
|
10436e |
+ )
|
|
|
10436e |
+ in
|
|
|
10436e |
+
|
|
|
10436e |
({
|
|
|
10436e |
s_hypervisor = hypervisor;
|
|
|
10436e |
s_name = name; s_orig_name = name;
|
|
|
10436e |
--
|
|
|
498672 |
2.18.4
|
|
|
10436e |
|