qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PULL 16/16] vl: Deprecate -mon pretty=... for HMP monitors
Date: Wed, 19 Jun 2019 10:20:09 +0100	[thread overview]
Message-ID: <20190619092009.GD24236@redhat.com> (raw)
In-Reply-To: <20190619091852.GA15551@linux.fritz.box>

On Wed, Jun 19, 2019 at 11:18:52AM +0200, Kevin Wolf wrote:
> Am 19.06.2019 um 08:42 hat Markus Armbruster geschrieben:
> > Kevin Wolf <kwolf@redhat.com> writes:
> > 
> > > Am 18.06.2019 um 11:01 hat Daniel P. Berrangé geschrieben:
> > >> On Mon, Jun 17, 2019 at 08:49:03PM +0200, Markus Armbruster wrote:
> > >> > From: Kevin Wolf <kwolf@redhat.com>
> > >> > 
> > >> > The -mon pretty=on|off switch of the -mon option applies only to QMP
> > >> > monitors. It's silently ignored for HMP. Deprecate this combination so
> > >> > that we can make it an error in future versions.
> > >> 
> > >> No objection to merging this PR as is, but how about we extend the
> > >> deprecation to QMP too ?
> > >> 
> > >> I was responsible for adding this option back in 2010 and I don't
> > >> think I've used it since 2012 when I added pretty printing support
> > >> to scripts/qmp/qmp-shell. I struggle to imagine good reasons for
> > >> using QMP directly with pretty printing, as opposed to doing it
> > >> via qmp-shell or another wrapper tool.
> > >
> > > qemu-iotests uses it. It doesn't only make the output (and espeically
> > > diffs on failure) much more readable, but in fact also avoids very long
> > > lines in the refernce output that used to break patch emails when we
> > > didn't use pretty printing yet.
> > >
> > > So let's keep it for QMP, please.
> > 
> > Perhaps we can get rid of it if we find a suitable filter.
> > 
> > Hmm, Python comes with one: "python -m json.tool".  It expects just one
> > expression, and fails if anything follows:
> > 
> >     $ printf '{"execute": "qmp_capabilities"}\n{"execute": "query-version"}\n' | socat UNIX:/work/armbru/images/test-qmp STDIO | python3 -m json.tool
> >     Extra data: line 2 column 1 (char 134)
> > 
> > To pretty print a sequence of expressions, you have to wrap a loop
> > around it:
> > 
> >     $ printf '{"execute": "qmp_capabilities"}\n{"execute": "query-version"}\n' | socat UNIX:/work/armbru/images/test-qmp STDIO | { while read line; do echo "$line" | python3 -m json.tool; done; }
> 
> Yes, it's doable. It's not a very nice command line, but it does its
> job.
> 
> What do we win by removing pretty printing from qemu? We invest some
> work doing the patches, reviewing them, etc. and save the whole
> complexity of adding a few newlines and spaces to an already existing
> string buffer in a single place (qjson.c).
> 
> In exchange, we have to add the above overlong command line to every
> qemu-iotests case for which pretty printed QMP is useful, and lose the
> ability to just do -qmp-pretty stdio manually (which I do every now and
> then) instead of having to dig up the above line in some script to copy
> it.
> 
> It doesn't look like a net win to me.
> 
> > I figure we'd want to loop in Python instead of shell.
> > 
> > My point is: pretty-printing is trivial in Python.  The case for
> > maintaining C code to do it seems weak.
> 
> The pretty printing is fairly trivial in C, too, when you already
> generate JSON. The code seems to have been last touched in 2014, and
> before that in 2010 when it was introduced. The maintenance burden
> doesn't seem to be that bad.
> 
> Removing features that have users can be justified sometimes, but it
> does need a justification, in my opinion.

I'm fine with keeping the print-printing in QEMU given that you illustrated
an existing usage of it I wasn't aware of & its not difficult code to
maintain.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


  reply	other threads:[~2019-06-19  9:23 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-17 18:48 [Qemu-devel] [PULL 00/16] Monitor patches for 2019-06-17 Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 01/16] monitor: Fix return type of monitor_fdset_dup_fd_find Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 02/16] monitor: Remove unused password prompting fields Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 03/16] monitor: Split monitor_init in HMP and QMP function Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 04/16] monitor: Make MonitorQMP a child class of Monitor Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 05/16] monitor: Create MonitorHMP with readline state Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 06/16] monitor: Remove Monitor.cmd_table indirection Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 07/16] monitor: Rename HMP command type and tables Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 08/16] Move monitor.c to monitor/misc.c Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 09/16] monitor: Move {hmp, qmp}.c to monitor/{hmp, qmp}-cmds.c Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 10/16] monitor: Create monitor-internal.h with common definitions Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 11/16] monitor: Split out monitor/qmp.c Markus Armbruster
2019-06-17 18:48 ` [Qemu-devel] [PULL 12/16] monitor: Split out monitor/hmp.c Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 13/16] monitor: Split out monitor/monitor.c Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 14/16] monitor: Split Monitor.flags into separate bools Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 15/16] monitor: Replace monitor_init() with monitor_init_{hmp, qmp}() Markus Armbruster
2019-06-17 18:49 ` [Qemu-devel] [PULL 16/16] vl: Deprecate -mon pretty=... for HMP monitors Markus Armbruster
2019-06-18  9:01   ` Daniel P. Berrangé
2019-06-18 10:34     ` Kevin Wolf
2019-06-19  6:42       ` Markus Armbruster
2019-06-19  9:18         ` Kevin Wolf
2019-06-19  9:20           ` Daniel P. Berrangé [this message]
2019-06-17 18:58 ` [Qemu-devel] [PULL 00/16] Monitor patches for 2019-06-17 Peter Maydell
2019-06-18  6:07   ` Markus Armbruster
2019-06-17 20:04 ` no-reply
2019-06-17 22:49 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190619092009.GD24236@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).