All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command
@ 2015-02-24 13:51 Alberto Garcia
  2015-02-24 13:51 ` [Qemu-devel] [PATCH 1/1] qmp: Add support for requesting the list of arguments from a command Alberto Garcia
  2015-03-06 17:11 ` [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command Eric Blake
  0 siblings, 2 replies; 13+ messages in thread
From: Alberto Garcia @ 2015-02-24 13:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Alberto Garcia, Michael Roth, Luiz Capitulino

Hello,

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

   https://lists.gnu.org/archive/html/qemu-devel/2015-02/msg04231.html

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.

Thanks,

Berto

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

-- 
2.1.4

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-04-01 15:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-24 13:51 [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command Alberto Garcia
2015-02-24 13:51 ` [Qemu-devel] [PATCH 1/1] qmp: Add support for requesting the list of arguments from a command Alberto Garcia
2015-03-06 17:11 ` [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command Eric Blake
2015-03-11  9:18   ` Alberto Garcia
2015-03-11 10:21     ` Markus Armbruster
2015-03-11 10:39       ` Kevin Wolf
2015-03-11 16:02       ` Alberto Garcia
2015-03-11 19:22         ` Markus Armbruster
2015-03-12 12:39           ` Kevin Wolf
2015-03-14 16:12             ` Markus Armbruster
2015-04-01 15:02               ` Alberto Garcia
2015-04-01 15:30                 ` Markus Armbruster
2015-03-11 10:26   ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.