[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v8 18/23] qmp: support out-of-band (oob) executi
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v8 18/23] qmp: support out-of-band (oob) execution |
Date: |
Sat, 10 Mar 2018 20:37:42 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 03/09/2018 03:00 AM, Peter Xu wrote:
Having "allow-oob" to true for a command does not mean that this command
s/to/:/
will always be run in out-of-band mode. The out-of-band quick path will
only be executed if we specify the extra "run-oob" flag when sending the
QMP request:
{ "execute": "command-that-allows-oob",
"arguments": { ... },
"control": { "run-oob": true } }
The "control" key is introduced to store this extra flag. "control"
field is used to store arguments that are shared by all the commands,
rather than command specific arguments. Let "run-oob" be the first.
Note that in the patch I exported qmp_dispatch_check_obj() to be used to
check the request earlier, and at the same time allowed "id" field to be
there since actually we always allow that.
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Peter Xu <address@hidden>
---
include/qapi/qmp/dispatch.h | 2 ++
monitor.c | 84 ++++++++++++++++++++++++++++++++++++++++-----
qapi/qmp-dispatch.c | 33 +++++++++++++++++-
trace-events | 2 ++
4 files changed, 111 insertions(+), 10 deletions(-)
+
+ if (qmp_is_oob(req)) {
+ if (!qmp_oob_enabled(mon)) {
+ error_setg(errp, "Please enable Out-Of-Band first "
+ "for the session during capabilities negociation");
s/negociation/negotiation/
+++ b/qapi/qmp-dispatch.c
@@ -17,8 +17,9 @@
+/*
+ * Detect whether a request should be run out-of-band, by quickly
+ * peeking at whether we have: { "control": { "run-oob": True } }. By
s/True/true/
+ * default commands are run in-band.
+ */
+bool qmp_is_oob(QDict *dict)
+{
+ QBool *bool_obj;
+
+ dict = qdict_get_qdict(dict, "control");
+ if (!dict) {
+ return false;
+ }
+
+ bool_obj = qobject_to_qbool(qdict_get(dict, "run-oob"));
Another qobject_to() rebase victim.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
- Re: [Qemu-devel] [PATCH v8 14/23] monitor: separate QMP parser and dispatcher, (continued)
[Qemu-devel] [PATCH v8 16/23] monitor: send event when command queue full, Peter Xu, 2018/03/09
[Qemu-devel] [PATCH v8 15/23] qmp: add new event "command-dropped", Peter Xu, 2018/03/09
[Qemu-devel] [PATCH v8 17/23] qapi: introduce new cmd option "allow-oob", Peter Xu, 2018/03/09
[Qemu-devel] [PATCH v8 18/23] qmp: support out-of-band (oob) execution, Peter Xu, 2018/03/09
[Qemu-devel] [PATCH v8 19/23] qmp: isolate responses into io thread, Peter Xu, 2018/03/09
[Qemu-devel] [PATCH v8 20/23] monitor: enable IO thread for (qmp & !mux) typed, Peter Xu, 2018/03/09