From: Luiz Capitulino <lcapitulino@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Kevin Wolf <kwolf@redhat.com>,
jcody@redhat.com, qemu-devel@nongnu.org,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] qapi: Allow QMP/QAPI commands to have array inputs
Date: Wed, 22 Feb 2012 18:37:09 -0200 [thread overview]
Message-ID: <20120222183709.6d3fb14a@doriath.home> (raw)
In-Reply-To: <4F455095.3010508@codemonkey.ws>
On Wed, 22 Feb 2012 14:31:17 -0600
Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 02/22/2012 02:25 PM, Luiz Capitulino wrote:
> > On Wed, 22 Feb 2012 11:35:26 -0600
> > Anthony Liguori<anthony@codemonkey.ws> wrote:
> >
> >> On 02/22/2012 10:12 AM, Jeff Cody wrote:
> >>> On 02/22/2012 09:53 AM, Anthony Liguori wrote:
> >>>> On 02/20/2012 11:31 AM, Jeff Cody wrote:
> >>>>> The QAPI scripts allow for generating commands that receive parameter
> >>>>> input consisting of a list of custom structs, but the QMP input paramter
> >>>>> checking did not support receiving a qlist as opposed to a qdict for
> >>>>> input.
> >>>>
> >>>> What are you trying to send on the wire? Something like
> >>>>
> >>>> {"execute": "foo", "arguments": [ "a", "b", "c" ]}
> >>>>
> >>>> ?
> >>>>
> >>>> That's not valid per the QMP protocol. "arguments" must always be a QMP
> >>>> dictionary.
> >>>>
> >>>
> >>> Not a bare list like that (perhaps my wording was poor), but rather an array of
> >>> custom structs, that contain QMP dicts. In this particular case:
> >>>
> >>> {"execute": "blockdev-group-snapshot-sync", "arguments": [{ "device":
> >>> "ide-hd0","snapshot-file":"/some/place/my-image","format": "qcow2" }]}
> >>>
> >>> When specifying this in the schema JSON file as shown below[1], the QAPI scripts
> >>> generate the marshaller& visitor functions that handle everything correctly.
> >>> The monitor code, however, could not deal with the QList container for the input
> >>> parameters, prior to passing the data to the generated functions.
> >>>
> >>>
> >>> [1] JSON schema definition:
> >>>
> >>> { 'type': 'SnapshotDev',
> >>> 'data': {'device': 'str', 'snapshot-file': 'str', '*format': 'str' } }
> >>>
> >>> { 'command': 'blockdev-group-snapshot-sync',
> >>> 'data': { 'dev': [ 'SnapshotDev' ] } }
> >>
> >>
> >> This will end up looking like:
> >>
> >> { "execute": "blockdev-group-snapshot-sync",
> >> "arguments": { "dev": [{"device": "ide-hd0"....}] } }
> >>
> >> Which should work as expected in QMP. HMP argument validation doesn't handle
> >> arguments of lists but IMHO, it's time to kill that code.
> >>
> >> Luiz, what do you think?
> >
> > I don't think the code can just be dropped (if that's what you meant), as there
> > are some features on top of it, like auto-completion, suffix support (G, M, k, etc),
> > but it certainly can be improved.
> >
> > Also note that QMP does argument validation too, which is unfortunate enough to
> > be based on HMP's,
>
> Once everything is converted to middle mode, this validation can be dropped for
> QMP. The generated code should do thorough checking of arguments and can handle
> complex types.
That's cool, although we'll be switching to the new server too (hence the whole
current server will be dropped).
next prev parent reply other threads:[~2012-02-22 20:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-20 17:31 [Qemu-devel] [PATCH 0/3] Group Live Snapshots Jeff Cody
2012-02-20 17:31 ` [Qemu-devel] [PATCH 1/3] qapi: Allow QMP/QAPI commands to have array inputs Jeff Cody
2012-02-22 14:53 ` Anthony Liguori
2012-02-22 16:12 ` Jeff Cody
2012-02-22 17:35 ` Anthony Liguori
2012-02-22 17:47 ` Eric Blake
2012-02-22 17:56 ` Anthony Liguori
2012-02-22 18:32 ` Jeff Cody
2012-02-22 18:26 ` Jeff Cody
2012-02-22 20:25 ` Luiz Capitulino
2012-02-22 20:31 ` Anthony Liguori
2012-02-22 20:37 ` Luiz Capitulino [this message]
2012-02-20 17:31 ` [Qemu-devel] [PATCH 2/3] qapi: Introduce blockdev-group-snapshot-sync command Jeff Cody
2012-02-20 17:41 ` Eric Blake
2012-02-21 12:52 ` Jeff Cody
2012-02-20 17:31 ` [Qemu-devel] [PATCH 3/3] qapi: Introduce blockdev-query-group-snapshot-failure Jeff Cody
2012-02-20 17:48 ` Eric Blake
2012-02-21 14:11 ` Jeff Cody
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=20120222183709.6d3fb14a@doriath.home \
--to=lcapitulino@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.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).