Re: [PATCH v2] virsh: Add QMP command wrapping for 'qemu-monitor-command'

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

 



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

Michal




[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