From patchwork Tue Nov 16 16:01:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Roth X-Patchwork-Id: 71426 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 8B36DB713D for ; Wed, 17 Nov 2010 03:30:07 +1100 (EST) Received: from localhost ([127.0.0.1]:54506 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PIOPz-0002LS-HA for incoming@patchwork.ozlabs.org; Tue, 16 Nov 2010 11:30:03 -0500 Received: from [140.186.70.92] (port=35101 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PINzr-0006Jr-Qn for qemu-devel@nongnu.org; Tue, 16 Nov 2010 11:03:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PINzY-0005EL-Gb for qemu-devel@nongnu.org; Tue, 16 Nov 2010 11:02:48 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:35971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PINzY-0005EB-EC for qemu-devel@nongnu.org; Tue, 16 Nov 2010 11:02:44 -0500 Received: from d01relay01.pok.ibm.com (d01relay01.pok.ibm.com [9.56.227.233]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id oAGFk3M0014570 for ; Tue, 16 Nov 2010 10:46:03 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay01.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oAGG2h8Z256424 for ; Tue, 16 Nov 2010 11:02:43 -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 oAGG2g8Z014664 for ; Tue, 16 Nov 2010 11:02:43 -0500 Received: from localhost.localdomain (sig-9-76-106-234.mts.ibm.com [9.76.106.234]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id oAGG24rk011388; Tue, 16 Nov 2010 11:02:40 -0500 From: Michael Roth To: qemu-devel@nongnu.org Date: Tue, 16 Nov 2010 10:01:56 -0600 Message-Id: <1289923320-5638-15-git-send-email-mdroth@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1289923320-5638-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1289923320-5638-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: aliguori@linux.vnet.ibm.com, ryanh@us.ibm.com, agl@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, abeekhof@redhat.com Subject: [Qemu-devel] [RFC][PATCH v4 14/18] virtagent: add client capabilities init function 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 Non-monitor version of agent_capabilities monitor function. This is called by the local RPC server when it gets a "hello" from the guest agent to re-negotiate guest agent capabilities. Signed-off-by: Michael Roth --- virtagent.c | 34 ++++++++++++++++++++++++++++++++++ virtagent.h | 1 + 2 files changed, 35 insertions(+), 0 deletions(-) diff --git a/virtagent.c b/virtagent.c index e0f7f99..4ec1b42 100644 --- a/virtagent.c +++ b/virtagent.c @@ -694,3 +694,37 @@ int do_agent_capabilities(Monitor *mon, const QDict *mon_params, return 0; } + +/* non-HMP/QMP RPC client functions */ + +int va_client_init_capabilities(void) +{ + xmlrpc_env env; + xmlrpc_value *params; + VARPCData *rpc_data; + int ret; + + xmlrpc_env_init(&env); + + params = xmlrpc_build_value(&env, "()"); + if (rpc_has_error(&env)) { + return -1; + } + + rpc_data = qemu_mallocz(sizeof(VARPCData)); + rpc_data->cb = do_agent_capabilities_cb; + rpc_data->mon_cb = NULL; + rpc_data->mon_data = NULL; + + ret = rpc_execute(&env, "system.listMethods", params, rpc_data); + if (ret == -EREMOTE) { + LOG("RPC Failed (%i): %s\n", env.fault_code, + env.fault_string); + return -1; + } else if (ret == -1) { + LOG("RPC communication error\n"); + return -1; + } + + return 0; +} diff --git a/virtagent.h b/virtagent.h index c10ee35..da4be60 100644 --- a/virtagent.h +++ b/virtagent.h @@ -23,6 +23,7 @@ #define VA_MAX_CHUNK_SIZE 4096 /* max bytes at a time for get/send file */ int va_client_init(VPDriver *vp_drv, bool is_host); +int va_client_init_capabilities(void); void do_agent_viewfile_print(Monitor *mon, const QObject *qobject); int do_agent_viewfile(Monitor *mon, const QDict *mon_params, MonitorCompletion cb, void *opaque);