[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC][PATCH v5 20/21] virtagent: integrate virtagent server
From: |
Michael Roth |
Subject: |
[Qemu-devel] [RFC][PATCH v5 20/21] virtagent: integrate virtagent server/client via chardev |
Date: |
Fri, 3 Dec 2010 12:03:21 -0600 |
This adds a new chardev, virtagent, which actually just passes back a
socket chardev after connecting to it and initializing the agent.
Signed-off-by: Michael Roth <address@hidden>
---
qemu-char.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 88997f9..5e83e09 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2399,6 +2399,54 @@ fail:
return NULL;
}
+#include "virtagent-common.h"
+
+static CharDriverState *qemu_chr_open_virtagent(QemuOpts *opts)
+{
+ CharDriverState *chr;
+ int fd, ret;
+
+ /* revert to/enforce default socket chardev options for virtagent */
+ if (qemu_opt_get(opts, "path") == NULL) {
+ qemu_opt_set(opts, "path", "/tmp/virtagent-client.sock");
+ }
+ //qemu_opt_set(opts, "id", "virtagent");
+ qemu_opt_set(opts, "server", "on");
+ qemu_opt_set(opts, "wait", "off");
+ qemu_opt_set(opts, "telnet", "off");
+
+ chr = qemu_chr_open_socket(opts);
+ if (chr == NULL) {
+ goto err;
+ }
+
+ /* connect immediately to the socket we set up.
+ * TODO: perhaps we should cut out the socket for the virtagent
+ * chardev case and use a couple pipe pairs for i/o?
+ */
+ fd = unix_connect_opts(opts);
+ if (fd == -1) {
+ fprintf(stderr, "error connecting to virtagent socket: %s",
+ strerror(errno));
+ }
+ socket_set_nonblock(fd);
+
+ /* pass fd to virtagent */
+ ret = va_init(VA_CTX_HOST, fd);
+ if (ret != 0) {
+ fprintf(stderr, "error initializing virtagent");
+ goto err;
+ }
+
+ return chr;
+
+err:
+ if (chr) {
+ qemu_free(chr);
+ }
+ return NULL;
+}
+
static const struct {
const char *name;
CharDriverState *(*open)(QemuOpts *opts);
@@ -2408,6 +2456,7 @@ static const struct {
{ .name = "udp", .open = qemu_chr_open_udp },
{ .name = "msmouse", .open = qemu_chr_open_msmouse },
{ .name = "vc", .open = text_console_init },
+ { .name = "virtagent", .open = qemu_chr_open_virtagent },
#ifdef _WIN32
{ .name = "file", .open = qemu_chr_open_win_file_out },
{ .name = "pipe", .open = qemu_chr_open_win_pipe },
--
1.7.0.4
- [Qemu-devel] [RFC][PATCH v5 11/21] virtagent: add va.shutdown RPC, (continued)
- [Qemu-devel] [RFC][PATCH v5 11/21] virtagent: add va.shutdown RPC, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 06/21] virtagent: base server definitions, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 12/21] virtagent: add agent_shutdown qmp/hmp commands, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 14/21] virtagent: add agent_ping qmp/hmp commands, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 13/21] virtagent: add va.ping RPC, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 17/21] virtagent: add va.hello RPC, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 18/21] virtagent: add "hello" notification function for guest agent, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 19/21] virtagent: add virtagent guest daemon, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 20/21] virtagent: integrate virtagent server/client via chardev,
Michael Roth <=
- [Qemu-devel] [RFC][PATCH v5 15/21] virtagent: add agent_capabilities qmp/hmp commands, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 16/21] virtagent: add client capabilities init function, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 10/21] virtagent: add agent_viewdmesg qmp/hmp commands, Michael Roth, 2010/12/03
- [Qemu-devel] [RFC][PATCH v5 21/21] virtagent: various bits to build QEMU with virtagent, Michael Roth, 2010/12/03
- [Qemu-devel] Re: [RFC][PATCH v5 00/21] virtagent: host/guest RPC communication agent, Jes Sorensen, 2010/12/07
- Re: [Qemu-devel] [RFC][PATCH v5 00/21] virtagent: host/guest RPC communication agent, Stefan Hajnoczi, 2010/12/08