[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 05/26] qmp: Clean up how we enforce capabilit
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 05/26] qmp: Clean up how we enforce capability negotiation |
Date: |
Mon, 27 Feb 2017 10:39:17 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 02/26/2017 03:43 PM, Markus Armbruster wrote:
> To enforce capability negotiation before normal operation,
> handle_qmp_command() inspects every command before it's handed off to
> qmp_dispatch(). This is a bit of a layering violation, and results in
> duplicated code.
>
> Before capability negotiation (!cur_mon->in_command_mode), we fail
> commands other than "qmp_capabilities". This is what enforces
> capability negotiation.
>
> Afterwards, we fail command "qmp_capabilities".
>
> Clean this up as follows.
>
> The obvious place to fail a command is the command itself, so move the
> "afterwards" check to qmp_qmp_capabilities().
>
> We do the "before" check in every other command, but that would be
> bothersome. Instead, start without all the other commands, by
> registering only qmp_qmp_capabilities(). Register the others in
> qmp_qmp_capabilities().
>
> Additionally, replace the generic human-readable error message for
> CommandNotFound by one that reminds the user to run qmp_capabilities.
> Without that, we'd regress commit 2d5a834.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> monitor.c | 70
> ++++++++++++++++++++++++++++++++++++---------------------------
> 1 file changed, 40 insertions(+), 30 deletions(-)
>
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v2 18/26] tests-qobject-input-strict: Merge into test-qobject-input-visitor, (continued)
- [Qemu-devel] [PATCH v2 25/26] qapi: Fix object input visit beyond end of list, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 06/26] qmp: Drop duplicated QMP command object checks, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 26/26] qapi: Improve qobject visitor documentation, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 16/26] test-qobject-input-visitor: Use strict visitor, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 09/26] qapi: Improve a QObject input visitor error message, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 05/26] qmp: Clean up how we enforce capability negotiation, Markus Armbruster, 2017/02/26
- Re: [Qemu-devel] [PATCH v2 05/26] qmp: Clean up how we enforce capability negotiation,
Eric Blake <=
- [Qemu-devel] [PATCH v2 15/26] qom: Make object_property_set_qobject()'s input visitor strict, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 14/26] qapi: Make string input and opts visitor require non-null input, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 03/26] qmp-test: New, covering basic QMP protocol, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 07/26] qmp: Eliminate silly QERR_QMP_* macros, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 21/26] tests: Cover partial input visit of list, Markus Armbruster, 2017/02/26
- [Qemu-devel] [PATCH v2 24/26] tests: Cover input visit beyond end of list, Markus Armbruster, 2017/02/26