On Wed, Oct 09, 2019 at 02:19:46PM +0200, Martin Kletzander wrote: > Even though this option is not to be used according to the manual, it: > > a) still might be useful even for machine-readable logs > > b) should not break the machine-readable output
I'm a bit confused what you're trying to do here. Rich. > Signed-off-by: Martin Kletzander <mklet...@redhat.com> > --- > v2v/v2v.ml | 29 ++++++++++++++++++++++------- > 1 file changed, 22 insertions(+), 7 deletions(-) > > diff --git a/v2v/v2v.ml b/v2v/v2v.ml > index 4ee15663f261..508a2b4f39a5 100644 > --- a/v2v/v2v.ml > +++ b/v2v/v2v.ml > @@ -815,13 +815,28 @@ and actual_target_size target_file disk_stats = > > (* Save overlays if --debug-overlays option was used. *) > and preserve_overlays overlays src_name = > - List.iter ( > - fun ov -> > - let saved_filename = > - sprintf "%s/%s-%s.qcow2" overlay_dir src_name ov.ov_sd in > - rename ov.ov_overlay_file saved_filename; > - info (f_"Overlay saved as %s [--debug-overlays]") saved_filename > - ) overlays > + let filenames = List.map ( > + fun ov -> > + let saved_filename = > + sprintf "%s/%s-%s.qcow2" overlay_dir src_name ov.ov_sd in > + rename ov.ov_overlay_file saved_filename; > + saved_filename > + ) overlays in > + match machine_readable () with > + | None -> > + List.iter ( > + fun filename -> > + info (f_"Overlay saved as %s [--debug-overlays]") filename > + ) filenames > + | Some {pr} -> > + let json = [ > + "type", JSON.String "data"; > + "data", JSON.Dict [ > + "saved_overlays", > + JSON.List (List.map (fun s -> JSON.String s) filenames); > + ] > + ] in > + pr "%s\n" (JSON.string_of_doc json) > > (* Request guest caps based on source configuration. *) > and rcaps_from_source source = > -- > 2.23.0 -- 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 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs