[Top][All Lists]

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

[Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command

From: Alberto Garcia
Subject: [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command
Date: Tue, 24 Feb 2015 15:51:54 +0200


this is a follow-up to the comments from Eric Blake about my patches
to extend the block streaming API:


Since QEMU doesn't have an easy way to tell the arguments that a
particular QMP command supports, and it seems that it would be useful
for libvirt and possibly others, I decided to write a simple patch
that adds that feature.

This is not an attempt to implement full introspection, but rather a
subset for this use case. I anyway tried to design it so it's easy to
extend in the future with the rest of the information.

I added a new type, CommandArgumentInfo, which includes the name of an
argument and a boolean expressing whether it's optional or not.

     { 'type': 'CommandArgumentInfo',
       'data': {'name': 'str', 'optional': 'bool'} }

I did not include the type of the argument since it would complicate
the code and would require me to parse the json files in order to
include all the details. My understanding is that for this use case
what's important for libvirt is knowing whether the argument is
supported, not its type (which libvirt should already know). But
please correct me if I'm wrong.

A new command 'query-command-args' returns the list of all supported
arguments for a particular command:

     { 'command': 'query-command-args',
       'data': {'command': 'str' },
       'returns': ['CommandArgumentInfo'] }

Alternatively, the existing 'query-commands' can be extended to accept
an optional parameter that specifies whether to return the arguments
for each command. That list of arguments would be added to the
'CommandInfo' type:

     { 'command': 'query-commands',
       'data': {'*query-args': 'bool' },
       'returns': ['CommandInfo'] }

     { 'type': 'CommandInfo',
       'data': {'name': 'str', 'args': ['CommandArgumentInfo'] } }

I added both alternatives in this patch since I don't know what's the
most convenient one for libvirt, but of course either of them can be
removed. The amount of C code needed to have both compared to just one
is negligible, though.

Feedback is welcome.



Alberto Garcia (1):
  qmp: Add support for requesting the list of arguments from a command

 monitor.c        | 53 +++++++++++++++++++++++++++++++-
 qapi/common.json | 41 +++++++++++++++++++++++--
 qmp-commands.hx  | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 178 insertions(+), 9 deletions(-)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]