[libvirt] [PATCH 01/19] virsh: Add QMP command wrapping for 'qemu-monitor-command'

Peter Krempa pkrempa at redhat.com
Fri Jan 10 09:36:18 UTC 2020


On Fri, Dec 13, 2019 at 10:29:20 +0000, Daniel Berrange wrote:
> On Thu, Dec 12, 2019 at 12:16:11PM -0600, Eric Blake wrote:
> > On 12/12/19 11:18 AM, Peter Krempa wrote:
> > > Issuing simple QMP commands is pain as they need to be wrapped by the
> > > JSON wrapper:
> > > 
> > >   { "execute": "COMMAND" }
> > > 
> > > and optionally also:
> > > 
> > >   { "execute": "COMMAND", "arguments":...}
> > > 
> > > For simple commands without arguments we can add syntax sugar to virsh
> > > which allows simple usage of QMP and additionally prepares also for
> > > passing through of the 'arguments' section.
> > 
> > I'd give an example of the new syntax in the commit message:
> > 
> > virsh qemu-monitor-command domain --qmp COMMAND '{ARGUMENTS...}'
> > 
> > as shorthand for
> > 
> > virsh qemu-monitor-command domain '"execute":"COMMAND",
> > "arguments":{ARGUMENTS...}}'
> > 
> > But the sugar is indeed nice (one less layer of {} JSON).
> 
> This is still a pretty crude variant of what QEMU can do via
> the 'qmp-shell' command.
> 
> I wonder if a better long term bet is to turn 'qmp-shell' into
> an official QEMU tool & have it integrate with libvirt.
> 
> ie actually install qmo-shell into /usr/bin, give it a manpage
> and add a '-d DOMAIN' arg as a way to tell it to send commands
> to 'virsh qemu-monitor-command' instead of a UNIX socket.

I conisdered doing this at one point. The nice part would be that also
the QOM fuse thing shares the connection code and finding the right
thing in dom is extremely painful in many cases, so using midnight
commander would be fun.

Unfortunately at that point it was not super obvious where to add the
feature and I had better things to do.

At any rate, I think this goal is orthogonal for making
qemu-monitor-command more developer-friendly in the meanwhile.




More information about the libvir-list mailing list