[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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
> +    )
> +  in

ACK

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]