Patchwork [RFC,v5,16/21] virtagent: add client capabilities init function

login
register
mail settings
Submitter Michael Roth
Date Dec. 3, 2010, 6:03 p.m.
Message ID <1291399402-20366-17-git-send-email-mdroth@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/74181/
State New
Headers show

Comments

Michael Roth - Dec. 3, 2010, 6:03 p.m.
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 |   18 ++++++++++++++++++
 virtagent.h |    1 +
 2 files changed, 19 insertions(+), 0 deletions(-)

Patch

diff --git a/virtagent.c b/virtagent.c
index 269bbcd..887ad02 100644
--- a/virtagent.c
+++ b/virtagent.c
@@ -558,3 +558,21 @@  int do_agent_capabilities(Monitor *mon, const QDict *mon_params,
     xmlrpc_DECREF(params);
     return ret;
 }
+
+/* non-HMP/QMP RPC client functions */
+
+int va_client_init_capabilities(void)
+{
+    xmlrpc_env env;
+    xmlrpc_value *params;
+
+    xmlrpc_env_init(&env);
+
+    params = xmlrpc_build_value(&env, "()");
+    if (va_rpc_has_error(&env)) {
+        return -1;
+    }
+
+    return va_do_rpc(&env, "system.listMethods", params,
+                     do_agent_capabilities_cb, NULL, NULL);
+}
diff --git a/virtagent.h b/virtagent.h
index 8443c6f..440fe6d 100644
--- a/virtagent.h
+++ b/virtagent.h
@@ -42,5 +42,6 @@  int do_agent_ping(Monitor *mon, const QDict *mon_params,
 void do_agent_capabilities_print(Monitor *mon, const QObject *qobject);
 int do_agent_capabilities(Monitor *mon, const QDict *mon_params,
                   MonitorCompletion cb, void *opaque);
+int va_client_init_capabilities(void);
 
 #endif /* VIRTAGENT_H */