From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eric Blake" <eblake@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
peterx@redhat.com
Subject: [Qemu-devel] [PATCH for-2.12 3/8] monitor: new parameter "x-oob"
Date: Mon, 26 Mar 2018 14:38:56 +0800 [thread overview]
Message-ID: <20180326063901.27425-4-peterx@redhat.com> (raw)
In-Reply-To: <20180326063901.27425-1-peterx@redhat.com>
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.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
include/monitor/monitor.h | 1 +
monitor.c | 22 ++++++++++++++++++++--
vl.c | 5 +++++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 0cb0538a31..d6ab70cae2 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/monitor.c b/monitor.c
index eba98df9da..d77ccc8785 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"
@@ -4568,12 +4569,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;
+
+ 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, false);
+ 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,
@@ -4669,6 +4684,9 @@ QemuOptsList qemu_mon_opts = {
},{
.name = "pretty",
.type = QEMU_OPT_BOOL,
+ },{
+ .name = "x-oob",
+ .type = QEMU_OPT_BOOL,
},
{ /* end of list */ }
},
diff --git a/vl.c b/vl.c
index c81cc86607..5fd01bd5f6 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) {
--
2.14.3
next prev parent reply other threads:[~2018-03-26 6:39 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 6:38 [Qemu-devel] [PATCH for-2.12 0/8] Monitor: some oob related patches (fixes, new param, tests) Peter Xu
2018-03-26 6:38 ` [Qemu-devel] [PATCH for-2.12 1/8] qmp: fix qmp_capabilities error regression Peter Xu
2018-03-26 8:40 ` Marc-André Lureau
2018-03-26 19:35 ` Eric Blake
2018-03-26 6:38 ` [Qemu-devel] [PATCH for-2.12 2/8] qmp: cleanup qmp queues properly Peter Xu
2018-03-26 8:44 ` Marc-André Lureau
2018-03-26 19:42 ` Eric Blake
2018-03-27 2:30 ` Peter Xu
2018-03-26 6:38 ` Peter Xu [this message]
2018-03-26 9:10 ` [Qemu-devel] [PATCH for-2.12 3/8] monitor: new parameter "x-oob" Marc-André Lureau
2018-03-26 9:13 ` Peter Xu
2018-03-26 20:01 ` Eric Blake
2018-03-26 6:38 ` [Qemu-devel] [PATCH for-2.12 4/8] qapi: restrict allow-oob value to be "true" Peter Xu
2018-03-26 9:11 ` Marc-André Lureau
2018-03-26 19:43 ` Eric Blake
2018-03-26 6:38 ` [Qemu-devel] [PATCH for-2.12 5/8] tests: let qapi-schema tests detect oob Peter Xu
2018-03-26 9:13 ` Marc-André Lureau
2018-03-26 6:38 ` [Qemu-devel] [PATCH for-2.12 6/8] tests: add oob-test for qapi-schema Peter Xu
2018-03-26 9:18 ` Marc-André Lureau
2018-03-26 20:26 ` Eric Blake
2018-03-26 6:39 ` [Qemu-devel] [PATCH for-2.12 7/8] tests: introduce qtest_init_with_qmp_format() Peter Xu
2018-03-26 9:18 ` Marc-André Lureau
2018-03-26 20:42 ` Eric Blake
2018-03-26 21:48 ` Eric Blake
2018-03-26 6:39 ` [Qemu-devel] [PATCH for-2.12 8/8] tests: qmp-test: add test for new "x-oob" Peter Xu
2018-03-26 20:54 ` Eric Blake
2018-03-26 10:18 ` [Qemu-devel] [PATCH for-2.12 0/8] Monitor: some oob related patches (fixes, new param, tests) Christian Borntraeger
2018-03-27 2:26 ` Peter Xu
2018-03-26 22:29 ` Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180326063901.27425-4-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).