All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: aliguori@linux.vnet.ibm.com, ryanh@us.ibm.com,
	agl@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	abeekhof@redhat.com
Subject: Re: [Qemu-devel] [RFC][PATCH v4 14/18] virtagent: add client capabilities init function
Date: Thu, 18 Nov 2010 10:43:37 -0600	[thread overview]
Message-ID: <4CE557B9.5010501@linux.vnet.ibm.com> (raw)
In-Reply-To: <4CE53688.9070607@redhat.com>

On 11/18/2010 08:22 AM, Jes Sorensen wrote:
> On 11/16/10 17:01, Michael Roth wrote:
>> 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<mdroth@linux.vnet.ibm.com>
>> ---
>>   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;
>> +    }
>
> One of many examples that would have benefited from having a utility
> function doing most of the work here.
>

Agreed, I should be able to trim quite a few lines out of virtagent.c 
with a bit more code re-use.

> Cheers,
> Jes

  reply	other threads:[~2010-11-18 16:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16 16:01 [Qemu-devel] [RFC][PATCH v4 00/18] virtagent: host/guest RPC communication agent Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 01/18] virtagent: add common rpc transport defs Michael Roth
2010-11-18 13:53   ` Jes Sorensen
2010-11-18 16:33     ` Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 02/18] virtagent: base definitions for host/guest RPC server Michael Roth
2010-11-18 13:57   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 03/18] virtagent: qemu-vp, integrate virtagent server Michael Roth
2010-11-18 14:02   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 04/18] virtagent: base RPC client definitions Michael Roth
2010-11-18 14:10   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 05/18] virtagent: add getfile RPC Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 06/18] virtagent: add agent_viewfile command Michael Roth
2010-11-18 14:13   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 07/18] virtagent: add getdmesg RPC Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 08/18] virtagent: add agent_viewdmesg command Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 09/18] virtagent: add va_shutdown RPC Michael Roth
2010-11-18 14:17   ` Jes Sorensen
2010-11-18 15:35     ` Anthony Liguori
2010-11-18 15:41       ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 10/18] virtagent: add agent_shutdown monitor command Michael Roth
2010-11-18 14:19   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 11/18] virtagent: add va_ping RPC Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 12/18] virtagent: add agent_ping monitor command Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 13/18] virtagent: add agent_capabilities monitor function Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 14/18] virtagent: add client capabilities init function Michael Roth
2010-11-18 14:22   ` Jes Sorensen
2010-11-18 16:43     ` Michael Roth [this message]
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 15/18] virtagent: add va_hello RPC function Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 16/18] virtagent: add va_send_hello() client function Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 17/18] virtagent: qemu-vp, va_send_hello() on startup Michael Roth
2010-11-18 14:22   ` Jes Sorensen
2010-11-16 16:02 ` [Qemu-devel] [RFC][PATCH v4 18/18] virtagent: Makefile/configure changes to build virtagent bits Michael Roth
2010-11-18 13:50 ` [Qemu-devel] [RFC][PATCH v4 00/18] virtagent: host/guest RPC communication agent Jes Sorensen

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=4CE557B9.5010501@linux.vnet.ibm.com \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=abeekhof@redhat.com \
    --cc=agl@linux.vnet.ibm.com \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.