qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Denis V. Lunev" <den@virtuozzo.com>,
	"Cleber Rosa" <cleber@redhat.com>,
	"Stefan Hajnoczi" <stefanha@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Dominik Csapak" <d.csapak@proxmox.com>,
	"John Snow" <jsnow@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>
Subject: Re: qmp-shell for GSoC/Outreachy?
Date: Thu, 6 Feb 2020 18:26:39 +0000	[thread overview]
Message-ID: <20200206182639.GL3655@work-vm> (raw)
In-Reply-To: <20200206142143.GA4926@linux.fritz.box>

* Kevin Wolf (kwolf@redhat.com) wrote:
> Am 06.02.2020 um 10:40 hat Markus Armbruster geschrieben:
> > >> On 2/5/20 8:09 AM, Kevin Wolf wrote:
> > >> > Am 28.01.2020 um 11:59 hat Kevin Wolf geschrieben:
> > >> >>>> The other part that it needs to solve is how to be available by default
> > >> >>>> without specifying anything on the command line. Basically, if I press
> > >> >>>> Ctrl-Alt-2, I want to get to a monitor shell. If that shell is
> > >> >>>> implemented internally or by an external Python process, I don't mind.
> > >> >>>
> > >> >>> That is a harder part. (I rarely use Ctrl-Alt-2 actually; I mostly
> > >> >>> use HMP on stdin).
> > >> >>
> > >> >> I don't think it would be that hard, actually.
> > >> >>
> > >> >> If you have a -qmp-shell option that takes a chardev and defaults to vc,
> > >> >> you've solved the part with both stdio and Ctrl-Alt-2. Now all you need
> > >> >> to do is launch the Python child process, pass it a pair of pipes for
> > >> >> communication and forward everything between the pipes and the chardev.
> > >> >>
> > >> >> (That's the theory anyway.)
> > >> > 
> > >> > If someone is interested, I did a quick proof-of-concept hack:
> > >> > 
> > >> >     https://repo.or.cz/qemu/kevin.git/shortlog/refs/heads/qmp-shell
> > >> > 
> > >> > It doesn't clean up anything properly (including the qmp-shell processes
> > >> > it starts), but it spawns a usable qmp-shell on a user-specified
> > >> > character device. stdio seems to work, though without readline
> > >> > functionality (I suppose I still have line-buffering somewhere), vc
> > >> > doesn't really work at all yet.
> > >> > 
> > >> > Try it out like this:
> > >> > 
> > >> >     $ ./qemu-storage-daemon --chardev stdio,id=m --monitor m,mode=qmp-shell
> > >> >     monitor_qmp_event: 1
> > >> >     Welcome to the QMP low-level shell!
> > >> >     Connected to QEMU 4.2.50
> > >> > 
> > >> >     (QEMU) query-version
> > >> >     {"return": {"qemu": {"micro": 50, "major": 4, "minor": 2}, "package": "v4.2.0-1188-gd95a3885a9"}}
> > >> >     (QEMU) quit
> > >> > 
> > >> > (Or use x86_64-softmmu/qemu-system-x86_64, but it's based on the
> > >> > refactorings in the storage daemon branch, so why not try both at once?)
> > >> > 
> > >> > Polishing this to make it mergable would still require substantial work,
> > >> > so at the moment I'm not planning to do this. But if someone wants to
> > >> > pick it up, feel free (just let us know).
> > >> > 
> > >> > Hm, in fact... A qmp-shell GSoC project?
> > >> > 
> > >> 
> > >> That would be great. I worry that we should have a clear vision for the
> > >> syntax before we give this project to an intern, though. With a clear
> > >> vision and an outline for deliverables, it's an incredibly appropriate
> > >> project.
> > >> 
> > >> Some things I think we want to define before we start:
> > >> 
> > >> 1. What are we trying to achieve with a standalone shell?
> > 
> > Projects without a clear goal rarely succeed.  Success within three
> > months is even rarer.
> >
> > >> 2. What syntax should it use?
> > 
> > Leaving that to a GSoC student amounts to setting up for failure.
> 
> I think this subthread shows that we actually have many separate
> projects that people wish to have someone work on. Each of them is
> probably a bit too small for a whole GSoC, but all of them together are
> probably too much. So I'll guess the student would pick maybe two of
> them, and if time is left at the end, more can be added as a bonus.
> 
> 1. Something like --monitor mode=qmp-shell that just spawns an external
>    Python script and passes it a QMP socket. This is the fundamental
>    building block for having any kind of external monitor script
>    actually integrated in QEMU, so I think just running the existing
>    qmp-shell this way (with proper support for at least stdio and vc
>    chardevs) would make sense as a first milestone.

I was originally going to suggest that should be sugar for a
-chardev filter  that takes an in/out chardev - but I don't know how
you'd handle tty stuff like formatting and tab completion etc.

> 2. Rewriting qmp-shell to use a better syntax for nested data
>    structures. This would have to be defined before the project starts.
> 
> 3. Improving qmp-shell UI-wise, e.g. by having better autocompletion,
>    support for counting brackets, or whatever else was mentioned. We
>    have a few ideas, and there's room for the student to add their own
>    ideas, too.
> 
> 4. Something HMP-like. This isn't QMP any more, so it could as well be a
>    separate script (hmp-shell?). But it could also be integrated in
>    qmp-shell in the form of additional commands that are implemented
>    client-side. Or maybe have a single shell, but have a QMP mode and an
>    HMP mode and the user can switch between these modes.
> 
>    The syntax for the HMP shell/mode could be the same or different from
>    the QMP syntax. This would have to be defined beforehand, too.

separate script sharing the qmp interface code?

Dave

> 5. Probably more that I just forgot now.
> 
> Suggesting the exact goals is part of the student application process,
> but for fundamental things like the syntax we should probably already
> know what we want.
> 
> > >> I think those are the hardest parts.
> > >>
> > >> Below, some musings:
> > >> 
> > >> - An integrated QMP shell would be a great usability boost to users of
> > >> bare QEMU.
> > >> 
> > >> - It is undesirable in general to support two interfaces. Feature
> > >> disparity is a problem, as is needing to document and test two separate
> > >> interfaces. The quality disparity between the two is also an issue.
> > >> 
> > >> - Offering HMP via the GTK interface but not QMP is a discoverability
> > >> problem. Unfamiliar users might assume that HMP is our flagship
> > >> interface. It is not.
> > >> 
> > >> - We are unlikely to re-expand HMP to cover everything QMP does; writing
> > >> a QMP shell that makes QMP easy to interface with is a better solution
> > >> for removing redundancy and complexity.
> 
> I'm not entirely convinced of this because QMP is often too low-level to
> actually address the practical high-level needs of users.
> 
> But these HMP-ish things are probably easier to maintain as scripts
> outside of the QEMU binary, so I think some kind of "QMP with
> extensions" for human could be the solution.
> 
> Once it's an external script, it will also be easy to exchange the shell
> for another one depending on user preference, or to hack in whatever
> functionality they are missing.
> 
> > >> - I suspect that the target audience for users of naked QEMU are:
> > >>   - QEMU developers
> > >>   - Upper-layer developers (RHV, oVirt, KubeVirt, libvirt, kata, et al)
> > >> researching, testing, and debugging integration.
> > >>   - Devops professionals testing, implementing and debugging
> > >>     configuration & infrastructure
> > >>   - Security/infosec researchers
> > >>   - Embedded platform developers
> > >>   - Academic researchers
> 
> Maybe kernel developers should be mentioned separately, but yes, this
> list looks plausible to me.
> 
> > >> So please correct me if I am off the mark;
> > >> 
> > >> Design Goals:
> > >>   - The removal of HMP
> > >>   - An easy-to-use interface that remains reasonably "close" to the
> > >> machine API such that it provides a smooth transition to scripting QEMU.
> > >>   - Integration with our GTK interface for discoverability and convenience
> 
> As I listed above, I think these are actually three separate projects,
> rather than goals for a single big projects.
> 
> > >> Syntax:
> > >>   - TBD? Do we agree that the current syntax in qmp-shell is "bad" and
> > >> should be replaced? If yes, what should it look like?
> > >
> > > I believe it should be a python shell with added commands.
> > >
> > > Simple things should be simple.
> > >   e.g. adding a disk from a local file should be trivial.
> > >
> > > Complex things can be complex - but it would be better if they were
> > > simple.
> > >
> > >   It's OK if the worst case of a blockdev is a bit hairy, but
> > >   watch out for cases where the hairyness creeps in unnecessarily.
> > 
> > Designing interfaces to complex machinery is hard.  Experience tells
> > that we do okay when we focus on the building blocks first.  That's
> > -blockdev.  When we start with trying to make simple things simple, we
> > end in swamps.  That's -drive.
> > 
> > Focus on building blocks is of course no excuse for unnecessary
> > hairiness.
> > 
> > It's also no reason not to build more convenient things on top of the
> > building blocks.  I doubt they should go into QMP, though.
> 
> Right, they should be implemented in that external script, which would
> use the lower-level QMP building blocks to provide the functionality. I
> also think it's a good idea to keep QMP accessible for more exotic use
> cases when the simple thing just doesn't cut it any more.
> 
> > > If the user screwsup, it should give an error that prompts the user
> > > to the parameter they got wrong.
> > >
> > > Output from commands should normally be pretty formatted (with an option
> > > to display raw json for those needing it).
> > >   e.g. that 'query-version' should give either just the package
> > >   version (as info version currently does) or:
> > >       4.2.50  Package: v4.2.0-1188-gd95a3885a9
> > >
> > > We shouldn't lose any HMP commands that some people find useful
> > >   Ditching HMP isn't an option until we've got almost all of it
> > >   covered.
> > 
> > In particular, we currently use HMP for debugging and monitoring
> > purposes, where we don't need or want QMP's rigor, neither its rigorous
> > interface stability, nor its structured I/O.  We want the "whipuptitude"
> > we get from monitor_printf().  This is actually a point David has made
> > several times.
> > 
> > To have a qmp-shell replace HMP, I think it needs to be able to
> > 
> > * Go beyond 1:1
> > 
> >   We tried a 1:1 mapping between HMP and QMP commands, and it didn't
> >   work out.  HMP's replacement should let us build convenient commands
> >   from QMP building blocks.
> > 
> >   We tried a 1:1 mapping between HMP and QMP command arguments, guided
> >   by @args_type.  Worked out for simple cases, but was too constricting.
> 
> We need to go beyond 1:1, but we probably want to be able to offer 1:1
> as a subset of commands accepted in that shell.
> 
> Offering only 1:1 in a good way might already be a step forward.
> 
> > * Preserve "whipuptitude" [David]
> > 
> >   I figure that means allowing some in QMP.  Without compromising its
> >   core mission, of course.
> 
> As long as we confine it to x- commands, I think this is okay.
> 
> > * As discoverable as HMP is now [Kevin]
> > 
> > * Help, completion and such at least on par with what HMP provides now
> 
> Will we want to add new annotations in the schema for this?
> 
> For example, HMP has completion support for block device names. In the
> QAPI schema, these are simply 'str'. We could bake the knowledge that
> in command 'foo' the parameter 'bar' is a block device name, but that
> would be a hack and would probably rarely be consistent with what QEMU
> actually does. It's really something that schema introspection should be
> able to tell us.
> 
> Kevin
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2020-02-06 18:28 UTC|newest]

Thread overview: 183+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 16:13 Making QEMU easier for management tools and applications Stefan Hajnoczi
2019-12-20 21:07 ` Richard W.M. Jones
2020-01-02 11:26   ` Stefan Hajnoczi
2019-12-21  9:02 ` Markus Armbruster
2019-12-23 15:04   ` Michal Prívozník
2020-01-07  9:36     ` Kevin Wolf
2020-01-07 10:55       ` Michal Privoznik
2020-01-07 12:57         ` Kevin Wolf
2020-01-07 17:53           ` Christophe de Dinechin
2019-12-24 13:41   ` Daniel P. Berrangé
2020-01-22 22:28     ` John Snow
2020-01-23  7:19       ` Markus Armbruster
2020-01-23 17:58         ` John Snow
2020-01-23 19:01           ` Daniel P. Berrangé
2020-01-23 21:07             ` John Snow
2020-01-24  7:59               ` Markus Armbruster
2020-01-24 10:27                 ` Daniel P. Berrangé
2020-01-24 14:38                   ` Kevin Wolf
2020-01-24 18:23                     ` John Snow
2020-01-24 18:30                       ` Dr. David Alan Gilbert
2020-01-24 18:48                         ` John Snow
2020-01-24 18:52                           ` Dr. David Alan Gilbert
2020-01-24 18:58                             ` John Snow
2020-01-25 10:18                     ` Markus Armbruster
2020-01-27 10:18                       ` Daniel P. Berrangé
2020-01-27 12:48                         ` Markus Armbruster
2020-01-27 11:56                       ` Kevin Wolf
2020-01-27 12:04                         ` Peter Maydell
2020-01-27 20:11                         ` John Snow
2020-01-27 22:38                           ` Paolo Bonzini
2020-01-28  0:37                             ` John Snow
2020-01-28 10:16                             ` Daniel P. Berrangé
2020-01-28 10:39                               ` Kevin Wolf
2020-01-28 15:36                                 ` Markus Armbruster
2020-01-31 12:25                                   ` Eric Blake
2020-01-28 10:28                           ` Kevin Wolf
2020-01-28 12:36                             ` Markus Armbruster
2020-01-28 12:54                               ` Kevin Wolf
2020-01-28 13:45                                 ` Gerd Hoffmann
2020-01-31  6:50                                 ` Markus Armbruster
2020-01-31  7:48                                   ` Paolo Bonzini
2020-01-31  8:09                                     ` Markus Armbruster
2020-02-03 20:07                                   ` Andrea Bolognani
2020-02-04  9:58                                     ` Markus Armbruster
2020-01-31 12:27                                 ` Eric Blake
2020-02-02  9:21                                   ` Kevin Wolf
2020-02-02 10:44                                     ` Paolo Bonzini
2020-02-03  6:20                                       ` Markus Armbruster
2020-02-03  8:48                                         ` Markus Armbruster
2020-01-27 20:12                         ` Dr. David Alan Gilbert
2020-01-24 20:34                 ` John Snow
2020-01-27  8:35                   ` Gerd Hoffmann
2020-01-27 12:13                     ` Kevin Wolf
2020-01-27 16:18                       ` Gerd Hoffmann
2020-01-24  9:50               ` Daniel P. Berrangé
2020-01-25 11:52                 ` Paolo Bonzini
2020-01-27 10:05                   ` Daniel P. Berrangé
2020-01-27  8:25                 ` Tooling to help humans use JSON (was: Making QEMU easier for management tools and applications) Markus Armbruster
2020-01-27  9:06                 ` Making QEMU easier for management tools and applications Markus Armbruster
2020-01-27 10:00                   ` Daniel P. Berrangé
2020-01-27 14:35                 ` Kevin Wolf
2020-01-27 20:29                   ` Dr. David Alan Gilbert
2020-01-28 10:59                     ` Kevin Wolf
2020-02-05 13:09                       ` Kevin Wolf
2020-02-05 19:09                         ` qmp-shell for GSoC/Outreachy? (Was: Re: Making QEMU easier for management tools and applications) John Snow
2020-02-05 19:49                           ` Dr. David Alan Gilbert
2020-02-06  9:40                             ` qmp-shell for GSoC/Outreachy? Markus Armbruster
2020-02-06 10:09                               ` Daniel P. Berrangé
2020-02-06 12:11                                 ` Markus Armbruster
2020-02-06 12:15                                   ` Daniel P. Berrangé
2020-02-06 18:02                                     ` Dr. David Alan Gilbert
2020-02-07 21:03                                   ` John Snow
2020-02-08  7:17                                     ` Markus Armbruster
2020-02-06 14:21                               ` Kevin Wolf
2020-02-06 18:26                                 ` Dr. David Alan Gilbert [this message]
2020-02-07 10:49                                   ` Kevin Wolf
2020-02-07 21:23                                 ` John Snow
2020-02-08  7:25                                   ` Markus Armbruster
2020-02-10 11:59                                     ` Kevin Wolf
2020-02-10 12:26                                   ` Kevin Wolf
2020-02-06 18:18                               ` Dr. David Alan Gilbert
2020-02-07  7:47                                 ` Markus Armbruster
2020-02-07 21:31                                 ` Eric Blake
2020-02-08  7:34                                   ` Markus Armbruster
2020-02-07 21:56                                 ` John Snow
2020-02-07 20:56                               ` John Snow
2020-01-27 20:59                   ` Making QEMU easier for management tools and applications John Snow
2020-01-28 10:16                     ` Markus Armbruster
2020-01-28 19:21                       ` John Snow
2020-01-24  6:38           ` Markus Armbruster
2020-01-25 22:34           ` Christophe de Dinechin
2020-01-25 11:55     ` Paolo Bonzini
2020-01-02 14:47   ` Stefan Hajnoczi
2020-01-16 11:03     ` Kashyap Chamarthy
2020-01-20  9:55       ` Stefan Hajnoczi
2020-01-20 13:57         ` Kashyap Chamarthy
2020-01-25 11:41         ` Paolo Bonzini
2020-01-27 19:41           ` John Snow
2020-01-02 15:05   ` Dr. David Alan Gilbert
2020-01-13 13:44     ` Markus Armbruster
2019-12-24 13:00 ` Daniel P. Berrangé
2020-01-02 14:22   ` Stefan Hajnoczi
2020-01-22 22:42   ` John Snow
2020-01-23  7:21     ` Markus Armbruster
2020-01-23 10:27     ` Daniel P. Berrangé
2020-01-23 18:13       ` John Snow
2020-01-23 19:12         ` Daniel P. Berrangé
2020-01-02 15:10 ` Dr. David Alan Gilbert
2020-01-07 17:11 ` Christophe de Dinechin
2020-01-08 10:43   ` Kevin Wolf
2020-01-08 11:40     ` Christophe de Dinechin
2020-01-08 13:38       ` Kevin Wolf
2020-01-14 13:04         ` Markus Armbruster
2020-01-14 17:31           ` Christophe de Dinechin
2020-01-15  9:20             ` Markus Armbruster
2020-01-15  9:34               ` Christophe de Dinechin
2020-01-15 12:15                 ` Markus Armbruster
2020-01-15 12:19                   ` Daniel P. Berrangé
2020-01-15 14:02                     ` Markus Armbruster
2020-01-30 21:09                       ` Improving QOM documentation [Was: Re: Making QEMU easier for management tools and applications] Kashyap Chamarthy
2020-01-31  6:11                         ` Markus Armbruster
2020-01-31  7:46                           ` Paolo Bonzini
2020-01-31 15:37                             ` Christophe de Dinechin
2020-01-31 16:28                               ` Paolo Bonzini
2020-01-31  9:50                           ` Kashyap Chamarthy
2020-01-31 10:35                           ` Peter Maydell
2020-01-31 11:02                             ` Paolo Bonzini
2020-01-31 15:22                               ` Kashyap Chamarthy
2020-01-31 17:23                                 ` Markus Armbruster
2020-02-03  8:56                                   ` Paolo Bonzini
2020-02-03  9:54                                     ` Markus Armbruster
2020-02-03 15:21                                       ` Paolo Bonzini
2020-02-04  8:42                                         ` Markus Armbruster
2020-01-31 16:39                               ` Markus Armbruster
2020-01-20 10:08                   ` Making QEMU easier for management tools and applications Stefan Hajnoczi
2020-01-21  5:42                     ` Markus Armbruster
2020-01-21 11:32                       ` Stefan Hajnoczi
2020-01-21 12:03                         ` Marc-André Lureau
2020-01-21 13:36                           ` Integrating QOM into QAPI (was: Making QEMU easier for management tools and applications) Markus Armbruster
2020-01-21 14:36                             ` Daniel P. Berrangé
2020-01-21 15:01                               ` Integrating QOM into QAPI Markus Armbruster
2020-01-21 15:11                                 ` Marc-André Lureau
2020-01-21 16:21                                   ` Peter Maydell
2020-01-22  5:16                                     ` Getting whole-tree patches reviewed and merged (was: Integrating QOM into QAPI) Markus Armbruster
2020-02-07 21:53                                       ` Getting whole-tree patches reviewed and merged Eric Blake
2020-02-10 11:26                                         ` Paolo Bonzini
2020-02-10 16:04                                           ` Markus Armbruster
2020-02-10 16:12                                             ` Peter Maydell
2020-01-22 10:50                                   ` Integrating QOM into QAPI Alex Bennée
2020-01-22 12:24                                     ` Markus Armbruster
2020-01-22 12:42                                       ` Marc-André Lureau
2020-01-22 13:28                                         ` Peter Maydell
2020-01-22 13:32                                           ` Marc-André Lureau
2020-01-23  7:37                                         ` Markus Armbruster
2020-01-24 18:32                                         ` Paolo Bonzini
2020-01-25  4:44                                           ` Marc-André Lureau
2020-01-25  9:28                                             ` Paolo Bonzini
2020-01-25 21:25                                               ` Peter Maydell
2020-01-26  8:09                                   ` Christophe de Dinechin
2020-01-26  9:11                                     ` Marc-André Lureau
2020-01-26 16:47                                       ` Paolo Bonzini
2020-01-27 19:05                                         ` Christophe de Dinechin
2020-01-27 19:05                                       ` Christophe de Dinechin
2020-01-26 15:04                                     ` Peter Maydell
2020-01-27 19:05                                       ` Christophe de Dinechin
2020-01-28  8:00                                         ` Markus Armbruster
2020-01-28 10:03                                         ` Daniel P. Berrangé
2020-01-29 12:42                                           ` Christophe de Dinechin
2020-01-15  9:35               ` Making QEMU easier for management tools and applications Marc-André Lureau
2020-01-15 12:25                 ` Markus Armbruster
2020-01-25 17:18               ` Paolo Bonzini
2020-01-27  9:30                 ` Markus Armbruster
2020-01-13 16:30   ` Stefan Hajnoczi
2020-02-04 15:54 ` Summary of " Markus Armbruster
2020-02-05  6:38   ` Markus Armbruster
2020-02-10 10:56   ` Stefan Hajnoczi
2020-02-10 11:01     ` Peter Maydell
2020-02-10 11:08       ` Daniel P. Berrangé
2020-02-10 11:29         ` Peter Maydell
2020-02-10 11:04     ` Paolo Bonzini
2020-02-10 16:43     ` Markus Armbruster
2020-02-12 13:54       ` Stefan Hajnoczi
2020-02-12 14:03         ` Daniel P. Berrangé

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=20200206182639.GL3655@work-vm \
    --to=dgilbert@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=cleber@redhat.com \
    --cc=d.csapak@proxmox.com \
    --cc=den@virtuozzo.com \
    --cc=ehabkost@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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).