qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: agl@linux.vnet.ibm.com, abeekhof@redhat.com,
	mdroth@linux.vnet.ibm.com, root <root@arsenal.linuxperf9025.net>,
	aliguori@linux.vnet.ibm.com, ryanh@us.ibm.com,
	amit.shah@redhat.com
Subject: [Qemu-devel] [RFC][PATCH v3 10/11] virtagent: qemu integration, add va invocation via virtproxy chardev
Date: Wed, 10 Nov 2010 19:37:29 -0600	[thread overview]
Message-ID: <1289439450-23556-11-git-send-email-mdroth@linux.vnet.ibm.com> (raw)
In-Reply-To: <1289439450-23556-1-git-send-email-mdroth@linux.vnet.ibm.com>

From: root <root@arsenal.linuxperf9025.net>

With these modifications we can now start virtagent via a bool option to
the virtproxy chardev. For example:

qemu -chardev virtproxy,id=va_id,virtagent=on

and then passing the chardev id to whatever device we're using for the
transport (virtio/isa serial)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 qemu-char.c   |   24 ++++++++++++++++++++++++
 qemu-config.c |    3 +++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/qemu-char.c b/qemu-char.c
index e318acb..9f5efac 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1905,6 +1905,8 @@ return_err:
 /* Virtproxy chardev driver */
 
 #include "virtproxy.h"
+#include "virtagent.h"
+#include "virtagent-daemon.h"
 
 static int vp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
 {
@@ -1925,6 +1927,8 @@ static CharDriverState *qemu_chr_open_virtproxy(QemuOpts *opts)
 {
     CharDriverState *chr = qemu_mallocz(sizeof(CharDriverState));
     VPDriver *drv = vp_new(VP_CTX_CHARDEV, chr, 0, 0);
+    int ret;
+    bool enable_virtagent;
 
     chr->opaque = drv;
     chr->chr_write = vp_chr_write;
@@ -1937,10 +1941,30 @@ static CharDriverState *qemu_chr_open_virtproxy(QemuOpts *opts)
      * client/server, which will add it's oforwards/iforwards
      * using using virtproxy API calls directly
      */
+    enable_virtagent = qemu_opt_get_bool(opts, "virtagent", 0);
+    if (enable_virtagent) {
+        /* outbound RPCs */
+        ret = va_client_init(drv, true);
+        if (ret) {
+            fprintf(stderr, "error enabling virtagent client");
+            goto fail;
+        }
+        /* inbound RPCs */
+        ret = va_server_init(drv, true);
+        if (ret) {
+            fprintf(stderr, "error enabling virtagent server");
+            goto fail;
+        }
+    }
 
     /* for "info chardev" monitor command */
     chr->filename = NULL;
     return chr;
+
+fail:
+    qemu_free(drv);
+    qemu_free(chr);
+    return NULL;
 }
 
 /***********************************************************/
diff --git a/qemu-config.c b/qemu-config.c
index 52f18be..374182b 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -146,6 +146,9 @@ static QemuOptsList qemu_chardev_opts = {
         },{
             .name = "signal",
             .type = QEMU_OPT_BOOL,
+        },{
+            .name = "virtagent",
+            .type = QEMU_OPT_BOOL,
         },
         { /* end of list */ }
     },
-- 
1.7.0.4

  parent reply	other threads:[~2010-11-11  1:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11  1:37 [Qemu-devel] [RFC][PATCH v3 00/11] virtagent: host/guest RPC communication agent Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 01/11] virtagent: add common rpc transport defs Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 02/11] virtagent: base definitions for host/guest RPC server Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 03/11] virtagent: qemu-vp, integrate virtagent server Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 04/11] virtagent: base RPC client definitions Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 05/11] virtagent: add getfile RPC Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 06/11] virtagent: add agent_viewfile command Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 07/11] virtagent: add getdmesg RPC Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 08/11] virtagent: add agent_viewdmesg command Michael Roth
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 09/11] virtagent: qemu-vp integration, use virtagent init functions Michael Roth
2010-11-11  1:37 ` Michael Roth [this message]
2010-11-11  1:37 ` [Qemu-devel] [RFC][PATCH v3 11/11] virtagent: Makefile/configure changes to build virtagent bits Michael Roth
2010-11-25  9:39 ` [Qemu-devel] Re: [RFC][PATCH v3 00/11] virtagent: host/guest RPC communication agent Amit Shah

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=1289439450-23556-11-git-send-email-mdroth@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=abeekhof@redhat.com \
    --cc=agl@linux.vnet.ibm.com \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=amit.shah@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=root@arsenal.linuxperf9025.net \
    --cc=ryanh@us.ibm.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).