[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 06/14] qmp: fix qmp_capabilities error regression
From: |
Marc-André Lureau |
Subject: |
Re: [Qemu-devel] [PULL 06/14] qmp: fix qmp_capabilities error regression |
Date: |
Tue, 27 Mar 2018 17:01:25 +0200 |
On Tue, Mar 27, 2018 at 4:30 PM, Eric Blake <address@hidden> wrote:
> From: Peter Xu <address@hidden>
>
> When someone sends a command before QMP handshake, the error used to be
> like this:
>
> {"execute": "query-cpus"}
> {"error": {"class": "CommandNotFound", "desc":
> "Expecting capabilities negotiation with 'qmp_capabilities'"}}
>
> While after cf869d5317 it becomes:
>
> {"execute": "query-cpus"}
> {"error": {"class": "CommandNotFound", "desc":
> "The command query-cpus has not been found"}}
>
> Fix it back to the nicer one.
>
> Fixes: cf869d5317 ("qmp: support out-of-band (oob) execution", 2018-03-19)
> Reported-by: Marc-André Lureau <address@hidden>
> Signed-off-by: Peter Xu <address@hidden>
> Message-Id: <address@hidden>
> Reported-by: Marc-André Lureau <address@hidden>
Reviewed-by (not x2 Reported-by ;)
> Reviewed-by: Eric Blake <address@hidden>
> [eblake: commit message grammar tweaks]
> Signed-off-by: Eric Blake <address@hidden>
> ---
> monitor.c | 23 ++++++++---------------
> 1 file changed, 8 insertions(+), 15 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index de709fc2e5d..3b1ef34711b 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1203,8 +1203,14 @@ static bool qmp_cmd_oob_check(Monitor *mon, QDict
> *req, Error **errp)
>
> cmd = qmp_find_command(mon->qmp.commands, command);
> if (!cmd) {
> - error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
> - "The command %s has not been found", command);
> + if (mon->qmp.commands == &qmp_cap_negotiation_commands) {
> + error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
> + "Expecting capabilities negotiation "
> + "with 'qmp_capabilities'");
> + } else {
> + error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
> + "The command %s has not been found", command);
> + }
> return false;
> }
>
> @@ -4027,7 +4033,6 @@ static void monitor_qmp_dispatch_one(QMPRequest
> *req_obj)
> {
> Monitor *mon, *old_mon;
> QObject *req, *rsp = NULL, *id;
> - QDict *qdict = NULL;
> bool need_resume;
>
> req = req_obj->req;
> @@ -4050,18 +4055,6 @@ static void monitor_qmp_dispatch_one(QMPRequest
> *req_obj)
>
> cur_mon = old_mon;
>
> - if (mon->qmp.commands == &qmp_cap_negotiation_commands) {
> - qdict = qdict_get_qdict(qobject_to(QDict, rsp), "error");
> - if (qdict
> - && !g_strcmp0(qdict_get_try_str(qdict, "class"),
> - QapiErrorClass_str(ERROR_CLASS_COMMAND_NOT_FOUND))) {
> - /* Provide a more useful error message */
> - qdict_del(qdict, "desc");
> - qdict_put_str(qdict, "desc", "Expecting capabilities negotiation"
> - " with 'qmp_capabilities'");
> - }
> - }
> -
> /* Respond if necessary */
> monitor_qmp_respond(mon, rsp, NULL, id);
>
> --
> 2.14.3
>
>
--
Marc-André Lureau
- [Qemu-devel] [PULL 02/14] tests: Silence false positive warning on generated test name, (continued)
- [Qemu-devel] [PULL 02/14] tests: Silence false positive warning on generated test name, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 04/14] error: Remove NULL checks on error_propagate() calls, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 03/14] error: Strip trailing '\n' from error string arguments (again again), Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 01/14] qmp-test: fix response leak, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 07/14] qapi: restrict allow-oob value to be "true", Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 12/14] tests: Add parameter to qtest_init_without_qmp_handshake, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 10/14] qmp: cleanup qmp queues properly, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 11/14] monitor: new parameter "x-oob", Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 13/14] tests: qmp-test: add test for new "x-oob", Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 06/14] qmp: fix qmp_capabilities error regression, Eric Blake, 2018/03/27
- Re: [Qemu-devel] [PULL 06/14] qmp: fix qmp_capabilities error regression,
Marc-André Lureau <=
- [Qemu-devel] [PULL 14/14] hmp.c: Revert hmp_info_cpus output format change, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 09/14] tests: add oob-test for qapi-schema, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 08/14] tests: let qapi-schema tests detect oob, Eric Blake, 2018/03/27
- [Qemu-devel] [PULL 05/14] qdict: remove useless cast, Eric Blake, 2018/03/27
- Re: [Qemu-devel] [PULL 00/14] QAPI changes for 2018-03-27, 2.12-rc1, Eric Blake, 2018/03/27