From: Alberto Garcia <berto@igalia.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH 0/1] Get the list of arguments from a QMP command
Date: Tue, 24 Feb 2015 15:51:54 +0200 [thread overview]
Message-ID: <cover.1424785704.git.berto@igalia.com> (raw)
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
next reply other threads:[~2015-02-24 13:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 13:51 Alberto Garcia [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1424785704.git.berto@igalia.com \
--to=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).