diff options
author | Markus Armbruster | 2017-03-03 13:32:27 +0100 |
---|---|---|
committer | Markus Armbruster | 2017-03-05 09:14:11 +0100 |
commit | 635db18f68ded6abec11cd4cf64ebc15c1c6b190 (patch) | |
tree | ef96491b6c966d48f8515552f0ddc8da58f8eb44 /trace-events | |
parent | qapi-introspect: Mangle --prefix argument properly for C (diff) | |
download | qemu-635db18f68ded6abec11cd4cf64ebc15c1c6b190.tar.gz qemu-635db18f68ded6abec11cd4cf64ebc15c1c6b190.tar.xz qemu-635db18f68ded6abec11cd4cf64ebc15c1c6b190.zip |
qmp: Clean up how we enforce capability negotiation
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 with an alternate list of commands that
contains only "qmp_capabilities". Switch to the full list 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 <armbru@redhat.com>
Message-Id: <1488544368-30622-8-git-send-email-armbru@redhat.com>
[Mirco-optimization squashed in, commit message typo fixed]
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'trace-events')
0 files changed, 0 insertions, 0 deletions