aboutsummaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorOsier Yang <jyang@redhat.com>2012-09-14 22:42:15 +0800
committerOsier Yang <jyang@redhat.com>2012-09-17 13:54:57 +0800
commit00792722fddeca2ac828a581ef2077fb767f69ff (patch)
treeed1718a006f683b01dd6a15e011824b105788706 /daemon
parentnode_memory: Define the APIs to get/set memory parameters (diff)
downloadlibvirt-00792722fddeca2ac828a581ef2077fb767f69ff.tar.gz
libvirt-00792722fddeca2ac828a581ef2077fb767f69ff.tar.bz2
libvirt-00792722fddeca2ac828a581ef2077fb767f69ff.zip
node_memory: Wire up the RPC protocol
* src/rpc/gendispatch.pl: (virNodeSetMemoryParameters is the the special one which needs a connection object as the first argument, improve the generator to support it). * daemon/remote.c: (Implement the server side handler for virDomainGetMemoryParameters) * src/remote/remote_driver.c: (Implement the client side handler for virDomainGetMemoryParameters) * src/remote/remote_protocol.x: (New RPC procedures for the two new APIs and structs to represent the args and ret for it) * src/remote_protocol-structs: Likewise
Diffstat (limited to 'daemon')
-rw-r--r--daemon/remote.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/daemon/remote.c b/daemon/remote.c
index 6f20761d5..a3eda9ce0 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -4483,6 +4483,66 @@ cleanup:
return rv;
}
+static int
+remoteDispatchNodeGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_node_get_memory_parameters_args *args,
+ remote_node_get_memory_parameters_ret *ret)
+{
+ virTypedParameterPtr params = NULL;
+ int nparams = args->nparams;
+ unsigned int flags;
+ int rv = -1;
+ struct daemonClientPrivate *priv =
+ virNetServerClientGetPrivateData(client);
+
+ if (!priv->conn) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ goto cleanup;
+ }
+
+ flags = args->flags;
+
+ if (nparams > REMOTE_NODE_MEMORY_PARAMETERS_MAX) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
+ goto cleanup;
+ }
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+
+ if (virNodeGetMemoryParameters(priv->conn, params, &nparams, flags) < 0)
+ goto cleanup;
+
+ /* In this case, we need to send back the number of parameters
+ * supported
+ */
+ if (args->nparams == 0) {
+ ret->nparams = nparams;
+ goto success;
+ }
+
+ if (remoteSerializeTypedParameters(params, nparams,
+ &ret->params.params_val,
+ &ret->params.params_len,
+ args->flags) < 0)
+ goto cleanup;
+
+success:
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ virNetMessageSaveError(rerr);
+ virTypedParameterArrayClear(params, nparams);
+ VIR_FREE(params);
+ return rv;
+}
+
/*----- Helpers. -----*/
/* get_nonnull_domain and get_nonnull_network turn an on-wire