From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, armbru@redhat.com,
"Michael Roth" <mdroth@linux.vnet.ibm.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH v9 16/17] qapi: Tweak QmpInputVisitor to optionally do string conversion
Date: Thu, 14 Jul 2016 06:43:16 -0600 [thread overview]
Message-ID: <578788E4.9020205@redhat.com> (raw)
In-Reply-To: <20160714080423.GB18778@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2457 bytes --]
On 07/14/2016 02:04 AM, Daniel P. Berrange wrote:
> On Wed, Jul 13, 2016 at 09:50:27PM -0600, Eric Blake wrote:
>> Currently the QmpInputVisitor assumes that all scalar
>> values are directly represented as their final types.
>> ie it assumes an 'int' is using QInt, and a 'bool' is
>> using QBool.
>>
>> This adds an alternative mode where a QString can also
>> be parsed in place of the native type, by adding a parameter
>> and updating all callers. For now, only the testsuite sets
>> the new autocast parameter.
>>
>> This makes it possible to use QmpInputVisitor with a QDict
>> produced from QemuOpts, where everything is in string format.
>> It also makes it possible for the next patch to support
>> back-compat in legacy commands like 'netdev_add' that no
>> longer use QemuOpts, but must parse the same set of QMP
>> constructs that QemuOpts would historically allow.
>
> I'm not really a huge fan of the approach there. IMHO the
> input visitor should strictly operate in "all native types"
> or "all string types" mode. The way you've done it here
> means that users can actually mix & match strings vs native
> types for each individual parameter :-(
>
> IMHO, I'd suggest you try to parse netdev_add args with
> it in "all native types" mode, if that fails, then re-parse
> in "all string types" mode.
Sadly, this idea won't work. Without this series, the existing QMP
command 'netdev_add' takes mixed integers and strings in a single call,
by virtue of converting QObject into QemuOpts and back into QObject.
Forcing the parser to allow only integers or only strings would reject
current uses of netdev_add, and we don't yet have a good idea whether
any existing clients were depending on that behavior.
Also, see patch 17/17 - the easiest way to implement a relaxed QMP parse
is by setting a single flag which controls which visitor constructor is
used. Your idea of parsing once with integer-only, then falling back to
parse a second time with string-only, would complicate the generator to
have to create two different visitors, rather than passing a single
boolean parameter through to the single visitor constructor.
>
> For that you'd not have to modify my patch at all.
>
Also not quite true - your patch no longer applies to master, so it
needed rebasing anyway.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2016-07-14 12:43 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 3:50 [Qemu-devel] [PATCH for-2.7 v9 00/17] qapi netdev_add introspection (post-introspection cleanups subset F) Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 01/17] net: use Netdev instead of NetClientOptions in client init Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 02/17] qapi: Require all branches of flat union enum to be covered Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 03/17] qapi: Special case c_name() for empty type Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 04/17] qapi: Hide tag_name data member of variants Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 05/17] qapi: Add type.is_empty() helper Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 06/17] qapi: Drop useless gen_err_check() Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 07/17] qapi-event: Simplify visit of non-implicit data Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 08/17] qapi: Plumb in 'boxed' to qapi generator lower levels Eric Blake
2016-07-14 14:17 ` Markus Armbruster
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 09/17] qapi: Implement boxed types for commands/events Eric Blake
2016-07-14 14:26 ` Markus Armbruster
2016-07-14 16:23 ` Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 10/17] block: Simplify block_set_io_throttle Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 11/17] block: Simplify drive-mirror Eric Blake
2016-07-14 22:28 ` Eric Blake
2016-07-14 22:37 ` [Qemu-devel] [PATCH v9.5 " Eric Blake
2016-07-14 3:50 ` [Qemu-arm] [PATCH v9 12/17] qapi: Change Netdev into a flat union Eric Blake
2016-07-14 3:50 ` Eric Blake
2016-07-14 3:50 ` [Qemu-devel] " Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 13/17] net: Use correct type for bool flag Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 14/17] net: Complete qapi-fication of netdev_add Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 15/17] option: make parse_option_bool/number non-static Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 16/17] qapi: Tweak QmpInputVisitor to optionally do string conversion Eric Blake
2016-07-14 8:04 ` Daniel P. Berrange
2016-07-14 12:43 ` Eric Blake [this message]
2016-07-14 13:03 ` Daniel P. Berrange
2016-07-14 14:04 ` Eric Blake
2016-07-14 14:16 ` Daniel P. Berrange
2016-07-14 14:25 ` Eric Blake
2016-07-14 3:50 ` [Qemu-devel] [PATCH v9 17/17] qapi: Restore autocast behavior in 'netdev_add' Eric Blake
2016-07-14 16:42 ` [Qemu-devel] [PATCH for-2.7 v9 00/17] qapi netdev_add introspection (post-introspection cleanups subset F) Markus Armbruster
2016-07-15 7:13 ` Markus Armbruster
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=578788E4.9020205@redhat.com \
--to=eblake@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=berrange@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 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.