[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/14] monitor: new parameter "x-oob"
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PULL 11/14] monitor: new parameter "x-oob" |
Date: |
Tue, 27 Mar 2018 09:30:11 -0500 |
From: Peter Xu <address@hidden>
Add new parameter to optionally enable Out-Of-Band for a QMP server.
An example command line:
./qemu-system-x86_64 -chardev stdio,id=char0 \
-mon chardev=char0,mode=control,x-oob=on
By default, Out-Of-Band is off.
It is not allowed if either MUX or non-QMP is detected, since
Out-Of-Band is currently only for QMP, and non-MUX chardev backends.
Note that the client STILL has to request 'oob' during qmp_capabilities;
in part because the x-oob command line option may disappear in the
future if we decide the capabilities negotiation is sufficient.
Signed-off-by: Peter Xu <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
[eblake: enhance commit message]
Tested-by: Christian Borntraeger <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
include/monitor/monitor.h | 1 +
vl.c | 5 +++++
monitor.c | 22 ++++++++++++++++++++--
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 0cb0538a315..d6ab70cae23 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -13,6 +13,7 @@ extern Monitor *cur_mon;
#define MONITOR_USE_READLINE 0x02
#define MONITOR_USE_CONTROL 0x04
#define MONITOR_USE_PRETTY 0x08
+#define MONITOR_USE_OOB 0x10
bool monitor_cur_is_qmp(void);
diff --git a/vl.c b/vl.c
index c81cc866079..5fd01bd5f69 100644
--- a/vl.c
+++ b/vl.c
@@ -2404,6 +2404,11 @@ static int mon_init_func(void *opaque, QemuOpts *opts,
Error **errp)
if (qemu_opt_get_bool(opts, "pretty", 0))
flags |= MONITOR_USE_PRETTY;
+ /* OOB is off by default */
+ if (qemu_opt_get_bool(opts, "x-oob", 0)) {
+ flags |= MONITOR_USE_OOB;
+ }
+
chardev = qemu_opt_get(opts, "chardev");
chr = qemu_chr_find(chardev);
if (chr == NULL) {
diff --git a/monitor.c b/monitor.c
index 32d6114ac3a..51f4cf480f8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -36,6 +36,7 @@
#include "net/slirp.h"
#include "chardev/char-fe.h"
#include "chardev/char-io.h"
+#include "chardev/char-mux.h"
#include "ui/qemu-spice.h"
#include "sysemu/numa.h"
#include "monitor/monitor.h"
@@ -4562,12 +4563,26 @@ static void monitor_qmp_setup_handlers_bh(void *opaque)
void monitor_init(Chardev *chr, int flags)
{
Monitor *mon = g_malloc(sizeof(*mon));
+ bool use_readline = flags & MONITOR_USE_READLINE;
+ bool use_oob = flags & MONITOR_USE_OOB;
- monitor_data_init(mon, false, false);
+ if (use_oob) {
+ if (CHARDEV_IS_MUX(chr)) {
+ error_report("Monitor Out-Of-Band is not supported with "
+ "MUX typed chardev backend");
+ exit(1);
+ }
+ if (use_readline) {
+ error_report("Monitor Out-Of-band is only supported by QMP");
+ exit(1);
+ }
+ }
+
+ monitor_data_init(mon, false, use_oob);
qemu_chr_fe_init(&mon->chr, chr, &error_abort);
mon->flags = flags;
- if (flags & MONITOR_USE_READLINE) {
+ if (use_readline) {
mon->rs = readline_init(monitor_readline_printf,
monitor_readline_flush,
mon,
@@ -4663,6 +4678,9 @@ QemuOptsList qemu_mon_opts = {
},{
.name = "pretty",
.type = QEMU_OPT_BOOL,
+ },{
+ .name = "x-oob",
+ .type = QEMU_OPT_BOOL,
},
{ /* end of list */ }
},
--
2.14.3
- [Qemu-devel] [PULL 00/14] QAPI changes for 2018-03-27, 2.12-rc1, Eric Blake, 2018/03/27
- [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 <=
- [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
- [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