From: Nikunj A. Dadhania <nikunj(a)linux.vnet.ibm.com>
v3:
* Squased all the remote driver changes to one single big patch and
auto-generated is around 40%
* Implements domainSetMemoryParameters and domainGetMemoryParameters for remote
driver
daemon/remote.c
src/remote/remote_driver.c
* Auto generate the files using rpcgen and helper scripts in daemon/ directory
src/remote/remote_protocol.x
daemon/remote_dispatch_args.h
daemon/remote_dispatch_prototypes.h
daemon/remote_dispatch_ret.h
daemon/remote_dispatch_table.h
src/remote/remote_protocol.c
src/remote/remote_protocol.h
Signed-off-by: Nikunj A. Dadhania <nikunj(a)linux.vnet.ibm.com>
---
daemon/remote.c | 158 +++++++++++++++++++++++++++++++++++
daemon/remote_dispatch_args.h | 2
daemon/remote_dispatch_prototypes.h | 16 ++++
daemon/remote_dispatch_ret.h | 1
daemon/remote_dispatch_table.h | 10 ++
src/remote/remote_driver.c | 148 ++++++++++++++++++++++++++++++++-
src/remote/remote_protocol.c | 84 +++++++++++++++++++
src/remote/remote_protocol.h | 56 ++++++++++++
src/remote/remote_protocol.x | 42 +++++++++
9 files changed, 514 insertions(+), 3 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 118654c..c8977d8 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -2332,6 +2332,164 @@ remoteDispatchDomainSetMemory (struct qemud_server *server
ATTRIBUTE_UNUSED,
}
static int
+remoteDispatchDomainSetMemoryParameters (struct qemud_server *server ATTRIBUTE_UNUSED,
+ struct qemud_client *client ATTRIBUTE_UNUSED,
+ virConnectPtr conn,
+ remote_message_header *hdr ATTRIBUTE_UNUSED,
+ remote_error *rerr,
+ remote_domain_set_memory_parameters_args *args,
+ void *ret ATTRIBUTE_UNUSED)
+{
+ virDomainPtr dom;
+ int i, r, nparams;
+ virMemoryParameterPtr params;
+
+ nparams = args->params.params_len;
+
+ if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
+ remoteDispatchFormatError (rerr, "%s", _("nparams too
large"));
+ return -1;
+ }
+ if (VIR_ALLOC_N(params, nparams) < 0) {
+ remoteDispatchOOMError(rerr);
+ return -1;
+ }
+
+ /* Deserialise parameters. */
+ for (i = 0; i < nparams; ++i) {
+ if (virStrcpyStatic(params[i].field, args->params.params_val[i].field) ==
NULL) {
+ remoteDispatchFormatError(rerr, _("Field %s too big for
destination"),
+ args->params.params_val[i].field);
+ return -1;
+ }
+ params[i].type = args->params.params_val[i].value.type;
+ switch (params[i].type) {
+ case VIR_DOMAIN_MEMORY_FIELD_INT:
+ params[i].value.i =
args->params.params_val[i].value.remote_memory_param_value_u.i; break;
+ case VIR_DOMAIN_MEMORY_FIELD_UINT:
+ params[i].value.ui =
args->params.params_val[i].value.remote_memory_param_value_u.ui; break;
+ case VIR_DOMAIN_MEMORY_FIELD_LLONG:
+ params[i].value.l =
args->params.params_val[i].value.remote_memory_param_value_u.l; break;
+ case VIR_DOMAIN_MEMORY_FIELD_ULLONG:
+ params[i].value.ul =
args->params.params_val[i].value.remote_memory_param_value_u.ul; break;
+ case VIR_DOMAIN_MEMORY_FIELD_DOUBLE:
+ params[i].value.d =
args->params.params_val[i].value.remote_memory_param_value_u.d; break;
+ case VIR_DOMAIN_MEMORY_FIELD_BOOLEAN:
+ params[i].value.b =
args->params.params_val[i].value.remote_memory_param_value_u.b; break;
+ }
+ }
+
+ dom = get_nonnull_domain (conn, args->dom);
+ if (dom == NULL) {
+ VIR_FREE(params);
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ r = virDomainSetMemoryParameters (dom, params, nparams);
+ virDomainFree(dom);
+ VIR_FREE(params);
+ if (r == -1) {
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int remoteDispatchDomainGetMemoryParameters (struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *rerr,
+
remote_domain_get_memory_parameters_args *args,
+
remote_domain_get_memory_parameters_ret *ret)
+{
+ virDomainPtr dom;
+ virMemoryParameterPtr params;
+ int i, r, nparams;
+
+ nparams = args->nparams;
+
+ if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
+ remoteDispatchFormatError (rerr, "%s", _("nparams too
large"));
+ return -1;
+ }
+ if (VIR_ALLOC_N(params, nparams) < 0) {
+ remoteDispatchOOMError(rerr);
+ return -1;
+ }
+
+ dom = get_nonnull_domain (conn, args->dom);
+ if (dom == NULL) {
+ VIR_FREE(params);
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+
+ r = virDomainGetMemoryParameters (dom, params, &nparams);
+ if (r == -1) {
+ virDomainFree(dom);
+ VIR_FREE(params);
+ remoteDispatchConnError(rerr, conn);
+ return -1;
+ }
+ /* In this case, we need to send back the number of parameters
+ * supported
+ */
+ if (args->nparams == 0) {
+ ret->nparams = nparams;
+ goto success;
+ }
+
+ /* Serialise the memory parameters. */
+ ret->params.params_len = nparams;
+ if (VIR_ALLOC_N(ret->params.params_val, nparams) < 0)
+ goto oom;
+
+ for (i = 0; i < nparams; ++i) {
+ // remoteDispatchClientRequest will free this:
+ ret->params.params_val[i].field = strdup (params[i].field);
+ if (ret->params.params_val[i].field == NULL)
+ goto oom;
+
+ ret->params.params_val[i].value.type = params[i].type;
+ switch (params[i].type) {
+ case VIR_DOMAIN_MEMORY_FIELD_INT:
+ ret->params.params_val[i].value.remote_memory_param_value_u.i =
params[i].value.i; break;
+ case VIR_DOMAIN_MEMORY_FIELD_UINT:
+ ret->params.params_val[i].value.remote_memory_param_value_u.ui =
params[i].value.ui; break;
+ case VIR_DOMAIN_MEMORY_FIELD_LLONG:
+ ret->params.params_val[i].value.remote_memory_param_value_u.l =
params[i].value.l; break;
+ case VIR_DOMAIN_MEMORY_FIELD_ULLONG:
+ ret->params.params_val[i].value.remote_memory_param_value_u.ul =
params[i].value.ul; break;
+ case VIR_DOMAIN_MEMORY_FIELD_DOUBLE:
+ ret->params.params_val[i].value.remote_memory_param_value_u.d =
params[i].value.d; break;
+ case VIR_DOMAIN_MEMORY_FIELD_BOOLEAN:
+ ret->params.params_val[i].value.remote_memory_param_value_u.b =
params[i].value.b; break;
+ default:
+ remoteDispatchFormatError (rerr, "%s", _("unknown
type"));
+ goto cleanup;
+ }
+ }
+
+success:
+ virDomainFree(dom);
+ VIR_FREE(params);
+
+ return 0;
+
+oom:
+ remoteDispatchOOMError(rerr);
+cleanup:
+ virDomainFree(dom);
+ for (i = 0 ; i < nparams ; i++)
+ VIR_FREE(ret->params.params_val[i].field);
+ VIR_FREE(params);
+ return -1;
+}
+
+static int
remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
index ee95043..d8528b6 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -165,3 +165,5 @@
remote_domain_snapshot_delete_args val_remote_domain_snapshot_delete_args;
remote_domain_get_block_info_args val_remote_domain_get_block_info_args;
remote_domain_create_with_flags_args val_remote_domain_create_with_flags_args;
+ remote_domain_set_memory_parameters_args
val_remote_domain_set_memory_parameters_args;
+ remote_domain_get_memory_parameters_args
val_remote_domain_get_memory_parameters_args;
diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h
index cf1a0f9..b674bb4 100644
--- a/daemon/remote_dispatch_prototypes.h
+++ b/daemon/remote_dispatch_prototypes.h
@@ -258,6 +258,14 @@ static int remoteDispatchDomainGetMaxVcpus(
remote_error *err,
remote_domain_get_max_vcpus_args *args,
remote_domain_get_max_vcpus_ret *ret);
+static int remoteDispatchDomainGetMemoryParameters(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *err,
+ remote_domain_get_memory_parameters_args *args,
+ remote_domain_get_memory_parameters_ret *ret);
static int remoteDispatchDomainGetOsType(
struct qemud_server *server,
struct qemud_client *client,
@@ -522,6 +530,14 @@ static int remoteDispatchDomainSetMemory(
remote_error *err,
remote_domain_set_memory_args *args,
void *ret);
+static int remoteDispatchDomainSetMemoryParameters(
+ struct qemud_server *server,
+ struct qemud_client *client,
+ virConnectPtr conn,
+ remote_message_header *hdr,
+ remote_error *err,
+ remote_domain_set_memory_parameters_args *args,
+ void *ret);
static int remoteDispatchDomainSetSchedulerParameters(
struct qemud_server *server,
struct qemud_client *client,
diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h
index 75ac0b2..17c9bca 100644
--- a/daemon/remote_dispatch_ret.h
+++ b/daemon/remote_dispatch_ret.h
@@ -135,3 +135,4 @@
remote_domain_snapshot_current_ret val_remote_domain_snapshot_current_ret;
remote_domain_get_block_info_ret val_remote_domain_get_block_info_ret;
remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret;
+ remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret;
diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h
index ef00edd..47d95eb 100644
--- a/daemon/remote_dispatch_table.h
+++ b/daemon/remote_dispatch_table.h
@@ -987,3 +987,13 @@
.args_filter = (xdrproc_t) xdr_remote_domain_create_with_flags_args,
.ret_filter = (xdrproc_t) xdr_remote_domain_create_with_flags_ret,
},
+{ /* DomainSetMemoryParameters => 197 */
+ .fn = (dispatch_fn) remoteDispatchDomainSetMemoryParameters,
+ .args_filter = (xdrproc_t) xdr_remote_domain_set_memory_parameters_args,
+ .ret_filter = (xdrproc_t) xdr_void,
+},
+{ /* DomainGetMemoryParameters => 198 */
+ .fn = (dispatch_fn) remoteDispatchDomainGetMemoryParameters,
+ .args_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_args,
+ .ret_filter = (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret,
+},
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index c1051a1..1204f6a 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -2284,6 +2284,150 @@ done:
}
static int
+remoteDomainSetMemoryParameters (virDomainPtr domain,
+ virMemoryParameterPtr params, int nparams)
+{
+ int rv = -1;
+ remote_domain_set_memory_parameters_args args;
+ int i, do_error;
+ struct private_data *priv = domain->conn->privateData;
+
+ remoteDriverLock(priv);
+
+ make_nonnull_domain (&args.dom, domain);
+
+ /* Serialise the memory parameters. */
+ args.params.params_len = nparams;
+ if (VIR_ALLOC_N(args.params.params_val, nparams) < 0) {
+ virReportOOMError();
+ goto done;
+ }
+
+ do_error = 0;
+ for (i = 0; i < nparams; ++i) {
+ // call() will free this:
+ args.params.params_val[i].field = strdup (params[i].field);
+ if (args.params.params_val[i].field == NULL) {
+ virReportOOMError();
+ do_error = 1;
+ }
+ args.params.params_val[i].value.type = params[i].type;
+ switch (params[i].type) {
+ case VIR_DOMAIN_MEMORY_FIELD_INT:
+ args.params.params_val[i].value.remote_memory_param_value_u.i =
params[i].value.i; break;
+ case VIR_DOMAIN_MEMORY_FIELD_UINT:
+ args.params.params_val[i].value.remote_memory_param_value_u.ui =
params[i].value.ui; break;
+ case VIR_DOMAIN_MEMORY_FIELD_LLONG:
+ args.params.params_val[i].value.remote_memory_param_value_u.l =
params[i].value.l; break;
+ case VIR_DOMAIN_MEMORY_FIELD_ULLONG:
+ args.params.params_val[i].value.remote_memory_param_value_u.ul =
params[i].value.ul; break;
+ case VIR_DOMAIN_MEMORY_FIELD_DOUBLE:
+ args.params.params_val[i].value.remote_memory_param_value_u.d =
params[i].value.d; break;
+ case VIR_DOMAIN_MEMORY_FIELD_BOOLEAN:
+ args.params.params_val[i].value.remote_memory_param_value_u.b =
params[i].value.b; break;
+ default:
+ remoteError(VIR_ERR_RPC, "%s", _("unknown parameter
type"));
+ do_error = 1;
+ }
+ }
+
+ if (do_error) {
+ xdr_free ((xdrproc_t) xdr_remote_domain_set_memory_parameters_args, (char *)
&args);
+ goto done;
+ }
+
+ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS,
+ (xdrproc_t) xdr_remote_domain_set_memory_parameters_args, (char *)
&args,
+ (xdrproc_t) xdr_void, (char *) NULL) == -1)
+ goto done;
+
+ rv = 0;
+
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
+
+static int
+remoteDomainGetMemoryParameters (virDomainPtr domain,
+ virMemoryParameterPtr params, int *nparams)
+{
+ int rv = -1;
+ remote_domain_get_memory_parameters_args args;
+ remote_domain_get_memory_parameters_ret ret;
+ int i = -1;
+ struct private_data *priv = domain->conn->privateData;
+
+ remoteDriverLock(priv);
+
+ make_nonnull_domain (&args.dom, domain);
+ args.nparams = *nparams;
+
+ memset (&ret, 0, sizeof ret);
+ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS,
+ (xdrproc_t) xdr_remote_domain_get_memory_parameters_args, (char *)
&args,
+ (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret)
== -1)
+ goto done;
+
+ /* Check the length of the returned list carefully. */
+ if (ret.params.params_len > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX ||
+ ret.params.params_len > *nparams) {
+ remoteError(VIR_ERR_RPC, "%s",
+ _("remoteDomainGetMemoryParameters: "
+ "returned number of parameters exceeds limit"));
+ goto cleanup;
+ }
+ /* Handle the case when the caller does not know the number of parameters
+ * and is asking for the number of parameters supported
+ */
+ if (*nparams == 0) {
+ *nparams = ret.nparams;
+ rv = 0;
+ goto cleanup;
+ }
+
+ *nparams = ret.params.params_len;
+
+ /* Deserialise the result. */
+ for (i = 0; i < *nparams; ++i) {
+ if (virStrcpyStatic(params[i].field, ret.params.params_val[i].field) == NULL) {
+ remoteError(VIR_ERR_INTERNAL_ERROR,
+ _("Parameter %s too big for destination"),
+ ret.params.params_val[i].field);
+ goto cleanup;
+ }
+ params[i].type = ret.params.params_val[i].value.type;
+ switch (params[i].type) {
+ case VIR_DOMAIN_MEMORY_FIELD_INT:
+ params[i].value.i =
ret.params.params_val[i].value.remote_memory_param_value_u.i; break;
+ case VIR_DOMAIN_MEMORY_FIELD_UINT:
+ params[i].value.ui =
ret.params.params_val[i].value.remote_memory_param_value_u.ui; break;
+ case VIR_DOMAIN_MEMORY_FIELD_LLONG:
+ params[i].value.l =
ret.params.params_val[i].value.remote_memory_param_value_u.l; break;
+ case VIR_DOMAIN_MEMORY_FIELD_ULLONG:
+ params[i].value.ul =
ret.params.params_val[i].value.remote_memory_param_value_u.ul; break;
+ case VIR_DOMAIN_MEMORY_FIELD_DOUBLE:
+ params[i].value.d =
ret.params.params_val[i].value.remote_memory_param_value_u.d; break;
+ case VIR_DOMAIN_MEMORY_FIELD_BOOLEAN:
+ params[i].value.b =
ret.params.params_val[i].value.remote_memory_param_value_u.b; break;
+ default:
+ remoteError(VIR_ERR_RPC, "%s",
+ _("remoteDomainGetMemoryParameters: "
+ "unknown parameter type"));
+ goto cleanup;
+ }
+ }
+
+ rv = 0;
+
+cleanup:
+ xdr_free ((xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *)
&ret);
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
+
+static int
remoteDomainGetInfo (virDomainPtr domain, virDomainInfoPtr info)
{
int rv = -1;
@@ -10358,8 +10502,8 @@ static virDriver remote_driver = {
remoteDomainRevertToSnapshot, /* domainRevertToSnapshot */
remoteDomainSnapshotDelete, /* domainSnapshotDelete */
remoteQemuDomainMonitorCommand, /* qemuDomainMonitorCommand */
- NULL, /* domainSetMemoryParameters */
- NULL, /* domainGetMemoryParameters */
+ remoteDomainSetMemoryParameters, /* domainSetMemoryParameters */
+ remoteDomainGetMemoryParameters, /* domainGetMemoryParameters */
};
static virNetworkDriver network_driver = {
diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c
index 2483004..f05a66d 100644
--- a/src/remote/remote_protocol.c
+++ b/src/remote/remote_protocol.c
@@ -308,6 +308,53 @@ xdr_remote_sched_param (XDR *xdrs, remote_sched_param *objp)
}
bool_t
+xdr_remote_memory_param_value (XDR *xdrs, remote_memory_param_value *objp)
+{
+
+ if (!xdr_int (xdrs, &objp->type))
+ return FALSE;
+ switch (objp->type) {
+ case VIR_DOMAIN_MEMORY_FIELD_INT:
+ return FALSE;
+ break;
+ case VIR_DOMAIN_MEMORY_FIELD_UINT:
+ if (!xdr_u_int (xdrs, &objp->remote_memory_param_value_u.ui))
+ return FALSE;
+ break;
+ case VIR_DOMAIN_MEMORY_FIELD_LLONG:
+ if (!xdr_int64_t (xdrs, &objp->remote_memory_param_value_u.l))
+ return FALSE;
+ break;
+ case VIR_DOMAIN_MEMORY_FIELD_ULLONG:
+ if (!xdr_uint64_t (xdrs, &objp->remote_memory_param_value_u.ul))
+ return FALSE;
+ break;
+ case VIR_DOMAIN_MEMORY_FIELD_DOUBLE:
+ if (!xdr_double (xdrs, &objp->remote_memory_param_value_u.d))
+ return FALSE;
+ break;
+ case VIR_DOMAIN_MEMORY_FIELD_BOOLEAN:
+ if (!xdr_int (xdrs, &objp->remote_memory_param_value_u.b))
+ return FALSE;
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+bool_t
+xdr_remote_memory_param (XDR *xdrs, remote_memory_param *objp)
+{
+
+ if (!xdr_remote_nonnull_string (xdrs, &objp->field))
+ return FALSE;
+ if (!xdr_remote_memory_param_value (xdrs, &objp->value))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_remote_open_args (XDR *xdrs, remote_open_args *objp)
{
@@ -581,6 +628,43 @@ xdr_remote_domain_set_scheduler_parameters_args (XDR *xdrs,
remote_domain_set_sc
}
bool_t
+xdr_remote_domain_set_memory_parameters_args (XDR *xdrs,
remote_domain_set_memory_parameters_args *objp)
+{
+ char **objp_cpp0 = (char **) (void *) &objp->params.params_val;
+
+ if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+ return FALSE;
+ if (!xdr_array (xdrs, objp_cpp0, (u_int *) &objp->params.params_len,
REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX,
+ sizeof (remote_memory_param), (xdrproc_t) xdr_remote_memory_param))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_remote_domain_get_memory_parameters_args (XDR *xdrs,
remote_domain_get_memory_parameters_args *objp)
+{
+
+ if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->nparams))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
+xdr_remote_domain_get_memory_parameters_ret (XDR *xdrs,
remote_domain_get_memory_parameters_ret *objp)
+{
+ char **objp_cpp0 = (char **) (void *) &objp->params.params_val;
+
+ if (!xdr_array (xdrs, objp_cpp0, (u_int *) &objp->params.params_len,
REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX,
+ sizeof (remote_memory_param), (xdrproc_t) xdr_remote_memory_param))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->nparams))
+ return FALSE;
+ return TRUE;
+}
+
+bool_t
xdr_remote_domain_block_stats_args (XDR *xdrs, remote_domain_block_stats_args *objp)
{
diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h
index afe9287..83fd191 100644
--- a/src/remote/remote_protocol.h
+++ b/src/remote/remote_protocol.h
@@ -53,6 +53,7 @@ typedef remote_nonnull_string *remote_string;
#define REMOTE_NODE_DEVICE_CAPS_LIST_MAX 16384
#define REMOTE_NWFILTER_NAME_LIST_MAX 1024
#define REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX 16
+#define REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX 16
#define REMOTE_NODE_MAX_CELLS 1024
#define REMOTE_AUTH_SASL_DATA_MAX 65536
#define REMOTE_AUTH_TYPE_LIST_MAX 20
@@ -186,6 +187,25 @@ struct remote_sched_param {
};
typedef struct remote_sched_param remote_sched_param;
+struct remote_memory_param_value {
+ int type;
+ union {
+ int i;
+ u_int ui;
+ int64_t l;
+ uint64_t ul;
+ double d;
+ int b;
+ } remote_memory_param_value_u;
+};
+typedef struct remote_memory_param_value remote_memory_param_value;
+
+struct remote_memory_param {
+ remote_nonnull_string field;
+ remote_memory_param_value value;
+};
+typedef struct remote_memory_param remote_memory_param;
+
struct remote_open_args {
remote_string name;
int flags;
@@ -307,6 +327,30 @@ struct remote_domain_set_scheduler_parameters_args {
};
typedef struct remote_domain_set_scheduler_parameters_args
remote_domain_set_scheduler_parameters_args;
+struct remote_domain_set_memory_parameters_args {
+ remote_nonnull_domain dom;
+ struct {
+ u_int params_len;
+ remote_memory_param *params_val;
+ } params;
+};
+typedef struct remote_domain_set_memory_parameters_args
remote_domain_set_memory_parameters_args;
+
+struct remote_domain_get_memory_parameters_args {
+ remote_nonnull_domain dom;
+ int nparams;
+};
+typedef struct remote_domain_get_memory_parameters_args
remote_domain_get_memory_parameters_args;
+
+struct remote_domain_get_memory_parameters_ret {
+ struct {
+ u_int params_len;
+ remote_memory_param *params_val;
+ } params;
+ int nparams;
+};
+typedef struct remote_domain_get_memory_parameters_ret
remote_domain_get_memory_parameters_ret;
+
struct remote_domain_block_stats_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
@@ -2233,6 +2277,8 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194,
REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
+ REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
+ REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198,
};
typedef enum remote_procedure remote_procedure;
@@ -2288,6 +2334,8 @@ extern bool_t xdr_remote_auth_type (XDR *, remote_auth_type*);
extern bool_t xdr_remote_vcpu_info (XDR *, remote_vcpu_info*);
extern bool_t xdr_remote_sched_param_value (XDR *, remote_sched_param_value*);
extern bool_t xdr_remote_sched_param (XDR *, remote_sched_param*);
+extern bool_t xdr_remote_memory_param_value (XDR *, remote_memory_param_value*);
+extern bool_t xdr_remote_memory_param (XDR *, remote_memory_param*);
extern bool_t xdr_remote_open_args (XDR *, remote_open_args*);
extern bool_t xdr_remote_supports_feature_args (XDR *, remote_supports_feature_args*);
extern bool_t xdr_remote_supports_feature_ret (XDR *, remote_supports_feature_ret*);
@@ -2308,6 +2356,9 @@ extern bool_t xdr_remote_domain_get_scheduler_type_ret (XDR *,
remote_domain_ge
extern bool_t xdr_remote_domain_get_scheduler_parameters_args (XDR *,
remote_domain_get_scheduler_parameters_args*);
extern bool_t xdr_remote_domain_get_scheduler_parameters_ret (XDR *,
remote_domain_get_scheduler_parameters_ret*);
extern bool_t xdr_remote_domain_set_scheduler_parameters_args (XDR *,
remote_domain_set_scheduler_parameters_args*);
+extern bool_t xdr_remote_domain_set_memory_parameters_args (XDR *,
remote_domain_set_memory_parameters_args*);
+extern bool_t xdr_remote_domain_get_memory_parameters_args (XDR *,
remote_domain_get_memory_parameters_args*);
+extern bool_t xdr_remote_domain_get_memory_parameters_ret (XDR *,
remote_domain_get_memory_parameters_ret*);
extern bool_t xdr_remote_domain_block_stats_args (XDR *,
remote_domain_block_stats_args*);
extern bool_t xdr_remote_domain_block_stats_ret (XDR *,
remote_domain_block_stats_ret*);
extern bool_t xdr_remote_domain_interface_stats_args (XDR *,
remote_domain_interface_stats_args*);
@@ -2623,6 +2674,8 @@ extern bool_t xdr_remote_auth_type ();
extern bool_t xdr_remote_vcpu_info ();
extern bool_t xdr_remote_sched_param_value ();
extern bool_t xdr_remote_sched_param ();
+extern bool_t xdr_remote_memory_param_value ();
+extern bool_t xdr_remote_memory_param ();
extern bool_t xdr_remote_open_args ();
extern bool_t xdr_remote_supports_feature_args ();
extern bool_t xdr_remote_supports_feature_ret ();
@@ -2643,6 +2696,9 @@ extern bool_t xdr_remote_domain_get_scheduler_type_ret ();
extern bool_t xdr_remote_domain_get_scheduler_parameters_args ();
extern bool_t xdr_remote_domain_get_scheduler_parameters_ret ();
extern bool_t xdr_remote_domain_set_scheduler_parameters_args ();
+extern bool_t xdr_remote_domain_set_memory_parameters_args ();
+extern bool_t xdr_remote_domain_get_memory_parameters_args ();
+extern bool_t xdr_remote_domain_get_memory_parameters_ret ();
extern bool_t xdr_remote_domain_block_stats_args ();
extern bool_t xdr_remote_domain_block_stats_ret ();
extern bool_t xdr_remote_domain_interface_stats_args ();
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 8af469c..aa24f98 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -128,6 +128,9 @@ const REMOTE_NWFILTER_NAME_LIST_MAX = 1024;
/* Upper limit on list of scheduler parameters. */
const REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX = 16;
+/* Upper limit on list of memory parameters. */
+const REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX = 16;
+
/* Upper limit on number of NUMA cells */
const REMOTE_NODE_MAX_CELLS = 1024;
@@ -313,6 +316,26 @@ struct remote_sched_param {
remote_sched_param_value value;
};
+union remote_memory_param_value switch (int type) {
+ case VIR_DOMAIN_MEMORY_FIELD_INT:
+ int i;
+ case VIR_DOMAIN_MEMORY_FIELD_UINT:
+ unsigned int ui;
+ case VIR_DOMAIN_MEMORY_FIELD_LLONG:
+ hyper l;
+ case VIR_DOMAIN_MEMORY_FIELD_ULLONG:
+ unsigned hyper ul;
+ case VIR_DOMAIN_MEMORY_FIELD_DOUBLE:
+ double d;
+ case VIR_DOMAIN_MEMORY_FIELD_BOOLEAN:
+ int b;
+};
+
+struct remote_memory_param {
+ remote_nonnull_string field;
+ remote_memory_param_value value;
+};
+
/*----- Calls. -----*/
/* For each call we may have a 'remote_CALL_args' and 'remote_CALL_ret'
@@ -422,6 +445,21 @@ struct remote_domain_set_scheduler_parameters_args {
remote_sched_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>;
};
+struct remote_domain_set_memory_parameters_args {
+ remote_nonnull_domain dom;
+ remote_memory_param params<REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX>;
+};
+
+struct remote_domain_get_memory_parameters_args {
+ remote_nonnull_domain dom;
+ int nparams;
+};
+
+struct remote_domain_get_memory_parameters_ret {
+ remote_memory_param params<REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX>;
+ int nparams;
+};
+
struct remote_domain_block_stats_args {
remote_nonnull_domain dom;
remote_nonnull_string path;
@@ -2020,7 +2058,9 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE = 193,
REMOTE_PROC_DOMAIN_GET_BLOCK_INFO = 194,
REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON = 195,
- REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196
+ REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS = 196,
+ REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS = 197,
+ REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS = 198
/*
* Notice how the entries are grouped in sets of 10 ?