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 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 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"}

and:

  virsh qemu-monitor-command '{"execute":"query-machines"}'

will do nothing to the user's input.

Michal

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