From patchwork Thu Nov 11 01:37:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 70751 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7099DB7114 for ; Thu, 11 Nov 2010 12:52:44 +1100 (EST) Received: from localhost ([127.0.0.1]:40855 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGMLB-0008Sa-8d for incoming@patchwork.ozlabs.org; Wed, 10 Nov 2010 20:52:41 -0500 Received: from [140.186.70.92] (port=56543 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGMBr-0007k3-MP for qemu-devel@nongnu.org; Wed, 10 Nov 2010 20:43:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGM6y-0000IS-DW for qemu-devel@nongnu.org; Wed, 10 Nov 2010 20:38:28 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:49763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGM6y-0000Ho-8q for qemu-devel@nongnu.org; Wed, 10 Nov 2010 20:38:00 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oAB1LRNb021314 for ; Wed, 10 Nov 2010 20:21:27 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oAB1bxcL2121918 for ; Wed, 10 Nov 2010 20:37:59 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oAB1bwoD010838 for ; Wed, 10 Nov 2010 20:37:59 -0500 Received: from localhost.localdomain (sig-9-65-242-217.mts.ibm.com [9.65.242.217]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id oAB1bY1D009666; Wed, 10 Nov 2010 20:37:57 -0500 From: Michael Roth To: qemu-devel@nongnu.org Date: Wed, 10 Nov 2010 19:37:29 -0600 Message-Id: <1289439450-23556-11-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1289439450-23556-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1289439450-23556-1-git-send-email-mdroth@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: agl@linux.vnet.ibm.com, abeekhof@redhat.com, mdroth@linux.vnet.ibm.com, root , 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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: root 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 --- 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 */ } },