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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 12, 2019 at 19:30:27 +0100, Michal Privoznik wrote:
> On 12/12/19 7:16 PM, 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).
> 
> Since we won't use HMP to talk to qemu ever (even the small set of HMP
> commands we have are wrapped inside QMP once being sent down the wire), can

Specifically you already must use --hmp if you ever want to use HMP.

> we not use --qmp flag at all? Just look if there's "execute" in the user's
> input and if not add it there. For instance:
> 
>   virsh qemu-monitor-command query-machines
> 
> will expand to
> 
>   {"execute":"query-machines"}


At first I wanted to argue that I'd like to support passing raw
unmodified commands to qemu, but in fact libvirt itself parses the
string as JSON so that it can be re-wrapped with the monitor sequence
field, so you have to pass in JSON anyways.

Thus I'm okay with dropping the flag and deciding on whether the opening
'{' is present on input.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux