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

Daniel P. Berrangé berrange at redhat.com
Fri Dec 13 10:29:20 UTC 2019


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.


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 :|




More information about the libvir-list mailing list