Pino Toscano
2019-Apr-12 15:29 UTC
[Libguestfs] [PATCH] v2v: warn when the guest has direct network interfaces (RHBZ#1518539)
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 direct network interfaces, so at least this can be noticed when converting a guest. --- v2v/parse_libvirt_xml.ml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index 9cf4c496b..14cd82afd 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -499,6 +499,24 @@ let parse_libvirt_xml ?conn xml ) in + (* Check for direct attachments to physical network interfaces. + * (RHBZ#1518539) + *) + let () + let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/interface[@type='direct']" 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 direct network interface which will be ignored" + "this guest has direct network interfaces which will be ignored" + nr_nodes in + warning "%s" msg + ) + in + ({ s_hypervisor = hypervisor; s_name = name; s_orig_name = name; -- 2.20.1
Richard W.M. Jones
2019-Apr-12 15:37 UTC
Re: [Libguestfs] [PATCH] v2v: warn when the guest has direct network interfaces (RHBZ#1518539)
On Fri, Apr 12, 2019 at 05:29:33PM +0200, Pino Toscano wrote:> 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 direct network interfaces, so at least this can be noticed > when converting a guest. > --- > v2v/parse_libvirt_xml.ml | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml > index 9cf4c496b..14cd82afd 100644 > --- a/v2v/parse_libvirt_xml.ml > +++ b/v2v/parse_libvirt_xml.ml > @@ -499,6 +499,24 @@ let parse_libvirt_xml ?conn xml > ) > in > > + (* Check for direct attachments to physical network interfaces. > + * (RHBZ#1518539) > + *) > + let () > + let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/interface[@type='direct']" 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 direct network interface which will be ignored" > + "this guest has direct network interfaces which will be ignored" > + nr_nodes in > + warning "%s" msg > + ) > + in > +I guess we should fix fn_? Anyway ACK, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Possibly Parallel Threads
- [PATCH] v2v: warn when the guest has hostdev devices (RHBZ#1472719)
- [PATCH] v2v: start reading the new libvirt firmware autoselect
- [PATCH v2] v2v: Free XML objects in the correct order.
- [PATCH] v2v: Free XML objects in the correct order.
- [PATCH v2] v2v: Free XML objects in the correct order.