[Libguestfs] [PATCH] v2v: -o local: print libvirt XML

Richard W.M. Jones rjones at redhat.com
Thu Jun 28 07:33:58 UTC 2018


On Wed, Jun 27, 2018 at 07:26:12PM +0200, Pino Toscano wrote:
> In verbose mode, print the generated libvirt XML to stderr for
> debugging, just like -o libvirt does.
> ---
>  v2v/output_local.ml | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/v2v/output_local.ml b/v2v/output_local.ml
> index 4e1088afc..c70428134 100644
> --- a/v2v/output_local.ml
> +++ b/v2v/output_local.ml
> @@ -68,7 +68,13 @@ class output_local dir = object
>      let name = source.s_name in
>      let file = dir // name ^ ".xml" in
>  
> -    with_open_out file (fun chan -> DOM.doc_to_chan chan doc)
> +    with_open_out file (fun chan -> DOM.doc_to_chan chan doc);
> +
> +    if verbose () then (
> +      eprintf "resulting local libvirt XML:\n%!";

You don't really need the %! on this line,

> +      DOM.doc_to_chan stderr doc;
> +      eprintf "\n%!";

because you flush the final output here.

> +    )
>  end
>  
>  let output_local = new output_local

ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list