From: Markus Armbruster <armbru@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Jason Wang <jasowang@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v8 14/16] net: Complete qapi-fication of netdev_add
Date: Thu, 07 Jul 2016 14:57:05 +0200 [thread overview]
Message-ID: <87r3b5obby.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <1467514729-29366-15-git-send-email-eblake@redhat.com> (Eric Blake's message of "Sat, 2 Jul 2016 20:58:47 -0600")
Eric Blake <eblake@redhat.com> writes:
> We finally have all the required pieces for doing a type-safe
> representation of netdev_add as a flat union, where the
> discriminator 'type' now selects which additional members may
> appear in the "arguments" JSON object sent over QMP, and exposes
> those types through introspection, and without breaking command
> line parsing.
>
> Inline the function netdev_add() into its lone remaining caller.
>
> There are a few places where the QMP 'netdev_add' command is now
> more strict: anywhere that the QAPI lists an integer member, we
> now require a strict JSON integer (previously, we allowed both
> integers and strings, because the conversion from QMP to QemuOpts
> back to QObject collapsed them into integers). For example,
> pre-patch, both of these examples succeed, but post-patch, the
> second example fails:
>
> {'execute':'netdev_add',
> 'arguments':{'id':'net1', 'type':'hubport', 'hubid':1}}
> {"return": {}}
> {'execute':'netdev_add',
> 'arguments':{'id':'net2', 'type':'hubport', 'hubid':"2"}}
> {"error": {"class": "GenericError", "desc": "Invalid parameter type for 'hubid', expected: integer"}}
Needs to be covered in release notes.
> If that turns out to be problematic, we could resolve the problem
> by either adding a loose parsing mode to qmp-input-visitor (teaching
> it to accept a string encoding of an integer in place of an actual
> integer), or by using QAPI alternates. But that work should be
> in followup patches, if at all.
The sloppy typing is an accidental misfeature that is at odds with QMP's
design. As far as I can tell, it's not documented anywhere. But lots
of things aren't documented anywhere; the questions is whether they're
used.
If we find we must keep netdev_add misfeature-compatible, I want it
deprecated in favor of a new command that adheres to the QMP design.
Do we have to keep it misfeature-compatible proactively? How
comfortable are we with "wait see whether anything breaks" here?
The scenarios I want to avoid are "OMG, hold the release while we
improvise a misfeature-compatibility hack", and "OMG, we need a stable
release for misfeature compatibility a.s.a.p."
I'm okay with breaking misfeature compatibility in this patch, and
unbreak it separately if necessary.
> In qmp_netdev_add(), we still have to create a QemuOpts object
> so that qmp_netdev_del() will be able to remove a hotplugged
> network device; but the opts->head remains empty since we now
> manage all parsing through the QAPI object rather than QemuOpts.
This use of QemuOpts as a network backend directory has always been
somewhat questionable. More so now the QemuOpts is empty. But it's not
this patch's business.
> Signed-off-by: Eric Blake <eblake@redhat.com>
next prev parent reply other threads:[~2016-07-07 12:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-03 2:58 [Qemu-devel] [PATCH for-2.7 v8 00/16] qapi netdev_add introspection (post-introspection cleanups subset F) Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 01/16] net: use Netdev instead of NetClientOptions in client init Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 02/16] qapi: Require all branches of flat union enum to be covered Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 03/16] qapi: Hide tag_name data member of variants Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 04/16] qapi: Add type.is_empty() helper Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 05/16] qapi: Drop useless gen_err_check() Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 06/16] qapi-event: Simplify visit of non-implicit data Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 07/16] qapi: Plumb in 'box' to qapi generator lower levels Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 08/16] qapi: Implement boxed types for commands/events Eric Blake
2016-07-07 10:52 ` Markus Armbruster
2016-07-07 16:02 ` Eric Blake
2016-07-08 7:06 ` Markus Armbruster
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 09/16] block: Simplify block_set_io_throttle Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 10/16] block: Simplify drive-mirror Eric Blake
2016-07-05 20:27 ` [Qemu-devel] [Qemu-block] " John Snow
2016-07-05 22:16 ` Eric Blake
2016-07-05 22:17 ` John Snow
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 11/16] qapi-event: Reduce chance of collision with event data Eric Blake
2016-07-07 11:37 ` Markus Armbruster
2016-07-13 21:05 ` Eric Blake
2016-07-03 2:58 ` [Qemu-arm] [PATCH v8 12/16] qapi: Change Netdev into a flat union Eric Blake
2016-07-03 2:58 ` Eric Blake
2016-07-03 2:58 ` [Qemu-devel] " Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 13/16] net: Use correct type for bool flag Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 14/16] net: Complete qapi-fication of netdev_add Eric Blake
2016-07-07 12:57 ` Markus Armbruster [this message]
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 15/16] qapi: Allow anonymous branch types in flat union Eric Blake
2016-07-03 2:58 ` [Qemu-devel] [PATCH v8 16/16] schema: Drop pointless empty type CpuInfoOther Eric Blake
2016-07-07 13:40 ` [Qemu-devel] [PATCH for-2.7 v8 00/16] qapi netdev_add introspection (post-introspection cleanups subset F) 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=87r3b5obby.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=jasowang@redhat.com \
--cc=lcapitulino@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 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.