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%!";
+ DOM.doc_to_chan stderr doc;
+ eprintf "\n%!";
+ )
end
let output_local = new output_local
--
2.17.1
Richard W.M. Jones
2018-Jun-28 07:33 UTC
Re: [Libguestfs] [PATCH] v2v: -o local: print libvirt XML
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_localACK. 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
Possibly Parallel Threads
- [PATCH 1/2] common/mlstdutils: Add with_open_in and with_open_out functions.
- [PATCH] v2v: Add support for libosinfo metadata
- Re: [PATCH] v2v: Add support for libosinfo metadata
- [PATCH] v2v: -o libvirt: Get the <features/> right in the output XML (RHBZ#1159258).
- [PATCH v2] v2v: Add support for libosinfo metadata