[PATCH v2] virsh: Add QMP command wrapping for 'qemu-monitor-command'
Michal Prívozník
mprivozn at redhat.com
Thu Oct 14 07:31:42 UTC 2021
On 9/17/21 3:34 PM, 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:
>
> virsh qemu-monitor-command $VM query-status
>
> is equivalent to
>
> virsh qemu-monitor-command $VM '{"execute":"query-status"}'
>
> and
>
> virsh qemu-monitor-command $VM query-named-block-nodes '{"flat":true}'
> or
> virsh qemu-monitor-command $VM query-named-block-nodes '"flat":true'
>
> is equivalent to
>
> virsh qemu-monitor-command $VM '{"execute":"query-named-block-nodes", "arguments":{"flat":true}}'
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
>
> v2:
> - dropped the '--qmpwrap' option and do wrapping if we don't get a
> JSON object instead. Similarly for arguments.
>
> docs/manpages/virsh.rst | 16 ++++++-
> tools/virsh-domain.c | 98 ++++++++++++++++++++++++++++++++++++-----
> 2 files changed, 103 insertions(+), 11 deletions(-)
Reviewed-by: Michal Privoznik <mprivozn at redhat.com>
Michal
More information about the libvir-list
mailing list