Pino Toscano
2017-Aug-30 11:07 UTC
[Libguestfs] [PATCH] v2v: warn when the guest has hostdev devices (RHBZ#1472719)
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
Richard W.M. Jones
2017-Aug-30 12:03 UTC
Re: [Libguestfs] [PATCH] v2v: warn when the guest has hostdev devices (RHBZ#1472719)
On Wed, Aug 30, 2017 at 01:07:58PM +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 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 > + ) > + inACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Apparently Analagous Threads
- [PATCH] v2v: warn when the guest has direct network interfaces (RHBZ#1518539)
- [PATCH] v2v: start reading the new libvirt firmware autoselect
- [PATCH] v2v: Preserve VM Generation ID (RHBZ#1598350).
- [PATCH] v2v: parse_libvirt_xml: number disks from 0 (RHBZ#1615885)
- [PATCH] v2v: parse_libvirt_xml: handle srN CDROM devices (RHBZ#1612785)