From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: aliguori@linux.vnet.ibm.com, agl@linux.vnet.ibm.com,
mdroth@linux.vnet.ibm.com, Jes.Sorensen@redhat.com
Subject: [Qemu-devel] [RFC][PATCH v1 08/12] qemu-char: add qmp_proxy chardev
Date: Fri, 25 Mar 2011 14:47:55 -0500 [thread overview]
Message-ID: <1301082479-4058-9-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1301082479-4058-1-git-send-email-mdroth@linux.vnet.ibm.com>
This allows qemu to be started with guest agent support via:
qemu -chardev qmp_proxy,path=<optional>,id=qmp_proxy \
-device ...,chardev=qmp_proxy
It is essentially a wrapper for -chardev socket, which takes the extra
step of setting required defaults and initializing the qmp proxy by
passing the path argument along.
Not sure if this is the most elegant approach, but in terms of the
command-line invocation it seems to be the most consistent way to do
it.
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
qemu-char.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index d301925..6ff7698 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2275,6 +2275,51 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
return NULL;
}
+#include "qmp-proxy-core.h"
+
+extern QmpProxy *qmp_proxy_default;
+
+static CharDriverState *qemu_chr_open_qmp_proxy(QemuOpts *opts)
+{
+ CharDriverState *chr;
+ QmpProxy *p;
+ const char *path;
+
+ /* revert to/enforce default socket chardev options for qmp proxy */
+ path = qemu_opt_get(opts, "path");
+ if (path == NULL) {
+ path = QMP_PROXY_PATH_DEFAULT;
+ qemu_opt_set_qerr(opts, "path", path);
+ }
+ /* required options for qmp proxy */
+ qemu_opt_set_qerr(opts, "server", "on");
+ qemu_opt_set_qerr(opts, "wait", "off");
+ qemu_opt_set_qerr(opts, "telnet", "off");
+
+ chr = qemu_chr_open_socket(opts);
+ if (chr == NULL) {
+ goto err;
+ }
+
+ /* initialize virtagent using the socket we just set up */
+ if (qmp_proxy_default) {
+ fprintf(stderr, "error, multiple qmp guest proxies are not allowed\n");
+ }
+ p = qmp_proxy_new(path);
+ if (p == NULL) {
+ fprintf(stderr, "error initializing qmp guest proxy\n");
+ goto err;
+ }
+ qmp_proxy_default = p;
+
+ return chr;
+err:
+ if (chr) {
+ qemu_free(chr);
+ }
+ return NULL;
+}
+
/***********************************************************/
/* Memory chardev */
typedef struct {
@@ -2495,6 +2540,7 @@ static const struct {
|| defined(__FreeBSD_kernel__)
{ .name = "parport", .open = qemu_chr_open_pp },
#endif
+ { .name = "qmp_proxy", .open = qemu_chr_open_qmp_proxy },
};
CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
--
1.7.0.4
next prev parent reply other threads:[~2011-03-25 19:48 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-25 19:47 [Qemu-devel] [RFC][PATCH v1 00/11] QEMU Guest Agent: QMP-based host/guest communication (virtagent) Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 01/12] json-lexer: make lexer error-recovery more deterministic Michael Roth
2011-03-25 21:18 ` [Qemu-devel] " Anthony Liguori
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 02/12] json-streamer: add handling for JSON_ERROR token/state Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 03/12] json-parser: add handling for NULL token list Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 04/12] qapi: fix function name typo in qmp-gen.py Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 05/12] qapi: fix handling for null-return async callbacks Michael Roth
2011-03-25 21:22 ` [Qemu-devel] " Anthony Liguori
2011-03-28 16:47 ` Luiz Capitulino
2011-03-28 17:01 ` Anthony Liguori
2011-03-28 17:06 ` Luiz Capitulino
2011-03-28 17:19 ` Anthony Liguori
2011-03-28 17:27 ` Luiz Capitulino
2011-03-28 17:39 ` Anthony Liguori
2011-03-28 17:59 ` Michael Roth
2011-03-28 18:27 ` Anthony Liguori
2011-03-28 20:42 ` Michael Roth
2011-03-28 20:45 ` Anthony Liguori
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 06/12] qmp proxy: build qemu with guest proxy dependency Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 07/12] qmp proxy: core code for proxying qmp requests to guest Michael Roth
2011-03-25 21:27 ` [Qemu-devel] " Anthony Liguori
2011-03-25 21:56 ` Michael Roth
2011-03-28 19:05 ` Anthony Liguori
2011-03-28 19:57 ` Michael Roth
2011-03-25 19:47 ` Michael Roth [this message]
2011-03-25 21:29 ` [Qemu-devel] Re: [RFC][PATCH v1 08/12] qemu-char: add qmp_proxy chardev Anthony Liguori
2011-03-25 22:11 ` Michael Roth
2011-03-28 17:45 ` Anthony Liguori
2011-03-29 18:54 ` Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 09/12] guest agent: core marshal/dispatch interfaces Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 10/12] guest agent: qemu-ga daemon Michael Roth
2011-04-01 9:45 ` [Qemu-devel] " Jes Sorensen
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 11/12] guest agent: guest-side command implementations Michael Roth
2011-03-25 19:47 ` [Qemu-devel] [RFC][PATCH v1 12/12] guest agent: build qemu-ga, add QEMU-wide gio dep Michael Roth
2011-03-25 20:42 ` [Qemu-devel] Re: [RFC][PATCH v1 00/11] QEMU Guest Agent: QMP-based host/guest communication (virtagent) Michael Roth
2011-03-25 22:03 ` Anthony Liguori
2011-03-25 22:36 ` Michael Roth
2011-03-28 17:03 ` Anthony Liguori
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=1301082479-4058-9-git-send-email-mdroth@linux.vnet.ibm.com \
--to=mdroth@linux.vnet.ibm.com \
--cc=Jes.Sorensen@redhat.com \
--cc=agl@linux.vnet.ibm.com \
--cc=aliguori@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
/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).