Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters.
Signed-off-by: Gui Jianfeng <guijianf...@cn.fujitsu.com> --- daemon/remote.c | 210 +++++++++++++++++++++++++++++++++++ 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 | 173 ++++++++++++++++++++++++++++- src/remote/remote_protocol.c | 89 +++++++++++++++ src/remote/remote_protocol.h | 55 +++++++++ src/remote/remote_protocol.x | 44 +++++++- src/remote_protocol-structs | 35 ++++++ 10 files changed, 632 insertions(+), 3 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index c5509ad..feb26f6 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2384,6 +2384,216 @@ remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED, } static int +remoteDispatchDomainSetBlkioParameters(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_blkio_parameters_args + * args, void *ret ATTRIBUTE_UNUSED) +{ + virDomainPtr dom; + int i, r, nparams; + virBlkioParameterPtr params; + unsigned int flags; + + nparams = args->params.params_len; + flags = args->flags; + + if (nparams > REMOTE_DOMAIN_BLKIO_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_BLKIO_PARAM_INT: + params[i].value.i = + args->params.params_val[i].value. + remote_blkio_param_value_u.i; + break; + case VIR_DOMAIN_BLKIO_PARAM_UINT: + params[i].value.ui = + args->params.params_val[i].value. + remote_blkio_param_value_u.ui; + break; + case VIR_DOMAIN_BLKIO_PARAM_LLONG: + params[i].value.l = + args->params.params_val[i].value. + remote_blkio_param_value_u.l; + break; + case VIR_DOMAIN_BLKIO_PARAM_ULLONG: + params[i].value.ul = + args->params.params_val[i].value. + remote_blkio_param_value_u.ul; + break; + case VIR_DOMAIN_BLKIO_PARAM_DOUBLE: + params[i].value.d = + args->params.params_val[i].value. + remote_blkio_param_value_u.d; + break; + case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN: + params[i].value.b = + args->params.params_val[i].value. + remote_blkio_param_value_u.b; + break; + } + } + + dom = get_nonnull_domain(conn, args->dom); + if (dom == NULL) { + VIR_FREE(params); + remoteDispatchConnError(rerr, conn); + return -1; + } + + r = virDomainSetBlkioParameters(dom, params, nparams, flags); + virDomainFree(dom); + VIR_FREE(params); + if (r == -1) { + remoteDispatchConnError(rerr, conn); + return -1; + } + + return 0; +} + +static int +remoteDispatchDomainGetBlkioParameters(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_get_blkio_parameters_args + * args, + remote_domain_get_blkio_parameters_ret + * ret) +{ + virDomainPtr dom; + virBlkioParameterPtr params; + int i, r, nparams; + unsigned int flags; + + nparams = args->nparams; + flags = args->flags; + + if (nparams > REMOTE_DOMAIN_BLKIO_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 = virDomainGetBlkioParameters(dom, params, &nparams, flags); + 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 blkio 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_BLKIO_PARAM_INT: + ret->params.params_val[i]. + value.remote_blkio_param_value_u.i = + params[i].value.i; + break; + case VIR_DOMAIN_BLKIO_PARAM_UINT: + ret->params.params_val[i]. + value.remote_blkio_param_value_u.ui = + params[i].value.ui; + break; + case VIR_DOMAIN_BLKIO_PARAM_LLONG: + ret->params.params_val[i]. + value.remote_blkio_param_value_u.l = + params[i].value.l; + break; + case VIR_DOMAIN_BLKIO_PARAM_ULLONG: + ret->params.params_val[i]. + value.remote_blkio_param_value_u.ul = + params[i].value.ul; + break; + case VIR_DOMAIN_BLKIO_PARAM_DOUBLE: + ret->params.params_val[i]. + value.remote_blkio_param_value_u.d = + params[i].value.d; + break; + case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN: + ret->params.params_val[i]. + value.remote_blkio_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 remoteDispatchDomainSetMemoryParameters(struct qemud_server *server ATTRIBUTE_UNUSED, struct qemud_client *client diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h index 57962d1..e8b2a7e 100644 --- a/daemon/remote_dispatch_args.h +++ b/daemon/remote_dispatch_args.h @@ -172,3 +172,5 @@ remote_domain_open_console_args val_remote_domain_open_console_args; remote_domain_is_updated_args val_remote_domain_is_updated_args; remote_get_sysinfo_args val_remote_get_sysinfo_args; + remote_domain_set_blkio_parameters_args val_remote_domain_set_blkio_parameters_args; + remote_domain_get_blkio_parameters_args val_remote_domain_get_blkio_parameters_args; diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h index e59701a..692391b 100644 --- a/daemon/remote_dispatch_prototypes.h +++ b/daemon/remote_dispatch_prototypes.h @@ -218,6 +218,14 @@ static int remoteDispatchDomainGetAutostart( remote_error *err, remote_domain_get_autostart_args *args, remote_domain_get_autostart_ret *ret); +static int remoteDispatchDomainGetBlkioParameters( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_message_header *hdr, + remote_error *err, + remote_domain_get_blkio_parameters_args *args, + remote_domain_get_blkio_parameters_ret *ret); static int remoteDispatchDomainGetBlockInfo( struct qemud_server *server, struct qemud_client *client, @@ -538,6 +546,14 @@ static int remoteDispatchDomainSetAutostart( remote_error *err, remote_domain_set_autostart_args *args, void *ret); +static int remoteDispatchDomainSetBlkioParameters( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_message_header *hdr, + remote_error *err, + remote_domain_set_blkio_parameters_args *args, + void *ret); static int remoteDispatchDomainSetMaxMemory( struct qemud_server *server, struct qemud_client *client, diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h index 78e5469..114e832 100644 --- a/daemon/remote_dispatch_ret.h +++ b/daemon/remote_dispatch_ret.h @@ -139,3 +139,4 @@ remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret; remote_domain_is_updated_ret val_remote_domain_is_updated_ret; remote_get_sysinfo_ret val_remote_get_sysinfo_ret; + remote_domain_get_blkio_parameters_ret val_remote_domain_get_blkio_parameters_ret; diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h index 5d27390..627e8a8 100644 --- a/daemon/remote_dispatch_table.h +++ b/daemon/remote_dispatch_table.h @@ -1022,3 +1022,13 @@ .args_filter = (xdrproc_t) xdr_remote_get_sysinfo_args, .ret_filter = (xdrproc_t) xdr_remote_get_sysinfo_ret, }, +{ /* DomainSetBlkioParameters => 204 */ + .fn = (dispatch_fn) remoteDispatchDomainSetBlkioParameters, + .args_filter = (xdrproc_t) xdr_remote_domain_set_blkio_parameters_args, + .ret_filter = (xdrproc_t) xdr_void, +}, +{ /* DomainGetBlkioParameters => 205 */ + .fn = (dispatch_fn) remoteDispatchDomainGetBlkioParameters, + .args_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args, + .ret_filter = (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, +}, diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index abee1c5..d450ece 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -2445,6 +2445,175 @@ done: } static int +remoteDomainSetBlkioParameters (virDomainPtr domain, + virBlkioParameterPtr params, + int nparams, + unsigned int flags) +{ + int rv = -1; + remote_domain_set_blkio_parameters_args args; + int i, do_error; + struct private_data *priv = domain->conn->privateData; + + remoteDriverLock(priv); + + make_nonnull_domain (&args.dom, domain); + + /* Serialise the blkio parameters. */ + args.params.params_len = nparams; + args.flags = flags; + 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_BLKIO_PARAM_INT: + args.params.params_val[i].value.remote_blkio_param_value_u.i = + params[i].value.i; break; + case VIR_DOMAIN_BLKIO_PARAM_UINT: + args.params.params_val[i].value.remote_blkio_param_value_u.ui = + params[i].value.ui; break; + case VIR_DOMAIN_BLKIO_PARAM_LLONG: + args.params.params_val[i].value.remote_blkio_param_value_u.l = + params[i].value.l; break; + case VIR_DOMAIN_BLKIO_PARAM_ULLONG: + args.params.params_val[i].value.remote_blkio_param_value_u.ul = + params[i].value.ul; break; + case VIR_DOMAIN_BLKIO_PARAM_DOUBLE: + args.params.params_val[i].value.remote_blkio_param_value_u.d = + params[i].value.d; break; + case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN: + args.params.params_val[i].value.remote_blkio_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_blkio_parameters_args, + (char *) &args); + goto done; + } + + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS, + (xdrproc_t) xdr_remote_domain_set_blkio_parameters_args, + (char *) &args, (xdrproc_t) xdr_void, (char *) NULL) == -1) + goto done; + + rv = 0; + +done: + remoteDriverUnlock(priv); + return rv; +} + +static int +remoteDomainGetBlkioParameters (virDomainPtr domain, + virBlkioParameterPtr params, int *nparams, + unsigned int flags) +{ + int rv = -1; + remote_domain_get_blkio_parameters_args args; + remote_domain_get_blkio_parameters_ret ret; + int i = -1; + struct private_data *priv = domain->conn->privateData; + + remoteDriverLock(priv); + + make_nonnull_domain (&args.dom, domain); + args.nparams = *nparams; + args.flags = flags; + + memset (&ret, 0, sizeof ret); + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS, + (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret) == -1) + goto done; + + /* Check the length of the returned list carefully. */ + if (ret.params.params_len > REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX || + ret.params.params_len > *nparams) { + remoteError(VIR_ERR_RPC, "%s", + _("remoteDomainGetBlkioParameters: " + "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_BLKIO_PARAM_INT: + params[i].value.i = + ret.params.params_val[i].value.remote_blkio_param_value_u.i; + break; + case VIR_DOMAIN_BLKIO_PARAM_UINT: + params[i].value.ui = + ret.params.params_val[i].value.remote_blkio_param_value_u.ui; + break; + case VIR_DOMAIN_BLKIO_PARAM_LLONG: + params[i].value.l = + ret.params.params_val[i].value.remote_blkio_param_value_u.l; + break; + case VIR_DOMAIN_BLKIO_PARAM_ULLONG: + params[i].value.ul = + ret.params.params_val[i].value.remote_blkio_param_value_u.ul; + break; + case VIR_DOMAIN_BLKIO_PARAM_DOUBLE: + params[i].value.d = + ret.params.params_val[i].value.remote_blkio_param_value_u.d; + break; + case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN: + params[i].value.b = + ret.params.params_val[i].value.remote_blkio_param_value_u.b; + break; + default: + remoteError(VIR_ERR_RPC, "%s", + _("remoteDomainGetBlkioParameters: " + "unknown parameter type")); + goto cleanup; + } + } + + rv = 0; + +cleanup: + xdr_free ((xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, + (char *) &ret); +done: + remoteDriverUnlock(priv); + return rv; +} + +static int remoteDomainSetMemoryParameters (virDomainPtr domain, virMemoryParameterPtr params, int nparams, @@ -10946,8 +11115,8 @@ static virDriver remote_driver = { remoteDomainSetMemoryParameters, /* domainSetMemoryParameters */ remoteDomainGetMemoryParameters, /* domainGetMemoryParameters */ remoteDomainOpenConsole, /* domainOpenConsole */ - NULL, /* domainSetBlkioParameters */ - NULL, /* domainGetBlkioParameters */ + remoteDomainSetBlkioParameters, /* domainSetBlkioParameters */ + remoteDomainGetBlkioParameters, /* domainGetBlkioParameters */ }; static virNetworkDriver network_driver = { diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c index bae92ca..2a3daa6 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_blkio_param_value (XDR *xdrs, remote_blkio_param_value *objp) +{ + + if (!xdr_int (xdrs, &objp->type)) + return FALSE; + switch (objp->type) { + case VIR_DOMAIN_BLKIO_PARAM_INT: + return FALSE; + break; + case VIR_DOMAIN_BLKIO_PARAM_UINT: + if (!xdr_u_int (xdrs, &objp->remote_blkio_param_value_u.ui)) + return FALSE; + break; + case VIR_DOMAIN_BLKIO_PARAM_LLONG: + if (!xdr_int64_t (xdrs, &objp->remote_blkio_param_value_u.l)) + return FALSE; + break; + case VIR_DOMAIN_BLKIO_PARAM_ULLONG: + if (!xdr_uint64_t (xdrs, &objp->remote_blkio_param_value_u.ul)) + return FALSE; + break; + case VIR_DOMAIN_BLKIO_PARAM_DOUBLE: + if (!xdr_double (xdrs, &objp->remote_blkio_param_value_u.d)) + return FALSE; + break; + case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN: + if (!xdr_int (xdrs, &objp->remote_blkio_param_value_u.b)) + return FALSE; + break; + default: + return FALSE; + } + return TRUE; +} + +bool_t +xdr_remote_blkio_param (XDR *xdrs, remote_blkio_param *objp) +{ + + if (!xdr_remote_nonnull_string (xdrs, &objp->field)) + return FALSE; + if (!xdr_remote_blkio_param_value (xdrs, &objp->value)) + return FALSE; + return TRUE; +} + +bool_t xdr_remote_memory_param_value (XDR *xdrs, remote_memory_param_value *objp) { @@ -646,6 +693,48 @@ xdr_remote_domain_set_scheduler_parameters_args (XDR *xdrs, remote_domain_set_sc } bool_t +xdr_remote_domain_set_blkio_parameters_args (XDR *xdrs, remote_domain_set_blkio_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_BLKIO_PARAMETERS_MAX, + sizeof (remote_blkio_param), (xdrproc_t) xdr_remote_blkio_param)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_domain_get_blkio_parameters_args (XDR *xdrs, remote_domain_get_blkio_parameters_args *objp) +{ + + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom)) + return FALSE; + if (!xdr_int (xdrs, &objp->nparams)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_domain_get_blkio_parameters_ret (XDR *xdrs, remote_domain_get_blkio_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_BLKIO_PARAMETERS_MAX, + sizeof (remote_blkio_param), (xdrproc_t) xdr_remote_blkio_param)) + return FALSE; + if (!xdr_int (xdrs, &objp->nparams)) + return FALSE; + return TRUE; +} + + +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; diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h index 46d526a..52a9d71 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_BLKIO_PARAMETERS_MAX 16 #define REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX 16 #define REMOTE_NODE_MAX_CELLS 1024 #define REMOTE_AUTH_SASL_DATA_MAX 65536 @@ -187,6 +188,25 @@ struct remote_sched_param { }; typedef struct remote_sched_param remote_sched_param; +struct remote_blkio_param_value { + int type; + union { + int i; + u_int ui; + int64_t l; + uint64_t ul; + double d; + int b; + } remote_blkio_param_value_u; +}; +typedef struct remote_blkio_param_value remote_blkio_param_value; + +struct remote_blkio_param { + remote_nonnull_string field; + remote_blkio_param_value value; +}; +typedef struct remote_blkio_param remote_blkio_param; + struct remote_memory_param_value { int type; union { @@ -337,6 +357,32 @@ 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_blkio_parameters_args { + remote_nonnull_domain dom; + struct { + u_int params_len; + remote_blkio_param *params_val; + } params; + u_int flags; +}; +typedef struct remote_domain_set_blkio_parameters_args remote_domain_set_blkio_parameters_args; + +struct remote_domain_get_blkio_parameters_args { + remote_nonnull_domain dom; + int nparams; + u_int flags; +}; +typedef struct remote_domain_get_blkio_parameters_args remote_domain_get_blkio_parameters_args; + +struct remote_domain_get_blkio_parameters_ret { + struct { + u_int params_len; + remote_blkio_param *params_val; + } params; + int nparams; +}; +typedef struct remote_domain_get_blkio_parameters_ret remote_domain_get_blkio_parameters_ret; + struct remote_domain_set_memory_parameters_args { remote_nonnull_domain dom; struct { @@ -2331,6 +2377,8 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, REMOTE_PROC_DOMAIN_IS_UPDATED = 202, REMOTE_PROC_GET_SYSINFO = 203, + REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS = 204, + REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 205, }; typedef enum remote_procedure remote_procedure; @@ -2386,6 +2434,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_blkio_param_value (XDR *, remote_blkio_param_value*); +extern bool_t xdr_remote_blkio_param (XDR *, remote_blkio_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*); @@ -2410,6 +2460,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_blkio_parameters_args (XDR *, remote_domain_set_blkio_parameters_args*); +extern bool_t xdr_remote_domain_get_blkio_parameters_args (XDR *, remote_domain_get_blkio_parameters_args*); +extern bool_t xdr_remote_domain_get_blkio_parameters_ret (XDR *, remote_domain_get_blkio_parameters_ret*); 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*); @@ -2734,6 +2787,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_blkio_param_value (); +extern bool_t xdr_remote_blkio_param (); extern bool_t xdr_remote_memory_param_value (); extern bool_t xdr_remote_memory_param (); extern bool_t xdr_remote_open_args (); diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index e77aca1..334c672 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 blkio parameters. */ +const REMOTE_DOMAIN_blkio_PARAMETERS_MAX = 16; + /* Upper limit on list of memory parameters. */ const REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX = 16; @@ -316,6 +319,26 @@ struct remote_sched_param { remote_sched_param_value value; }; +union remote_blkio_param_value switch (int type) { + case VIR_DOMAIN_BLKIO_PARAM_INT: + int i; + case VIR_DOMAIN_BLKIO_PARAM_UINT: + unsigned int ui; + case VIR_DOMAIN_BLKIO_PARAM_LLONG: + hyper l; + case VIR_DOMAIN_BLKIO_PARAM_ULLONG: + unsigned hyper ul; + case VIR_DOMAIN_BLKIO_PARAM_DOUBLE: + double d; + case VIR_DOMAIN_BLKIO_PARAM_BOOLEAN: + int b; +}; + +struct remote_blkio_param { + remote_nonnull_string field; + remote_blkio_param_value value; +}; + union remote_memory_param_value switch (int type) { case VIR_DOMAIN_MEMORY_PARAM_INT: int i; @@ -453,6 +476,23 @@ struct remote_domain_set_scheduler_parameters_args { remote_sched_param params<REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX>; }; +struct remote_domain_set_blkio_parameters_args { + remote_nonnull_domain dom; + remote_blkio_param params<REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX>; + unsigned int flags; +}; + +struct remote_domain_get_blkio_parameters_args { + remote_nonnull_domain dom; + int nparams; + unsigned int flags; +}; + +struct remote_domain_get_blkio_parameters_ret { + remote_blkio_param params<REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX>; + int nparams; +}; + struct remote_domain_set_memory_parameters_args { remote_nonnull_domain dom; remote_memory_param params<REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX>; @@ -2103,7 +2143,9 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, REMOTE_PROC_DOMAIN_IS_UPDATED = 202, - REMOTE_PROC_GET_SYSINFO = 203 + REMOTE_PROC_GET_SYSINFO = 203, + REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS = 204, + REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS = 205 /* * Notice how the entries are grouped in sets of 10 ? diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 6a7f03d..51d7368 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -70,6 +70,21 @@ struct remote_sched_param { remote_nonnull_string field; remote_sched_param_value value; }; +struct remote_blkio_param_value { + int type; + union { + int i; + u_int ui; + int64_t l; + uint64_t ul; + double d; + int b; + } remote_blkio_param_value_u; +}; +struct remote_blkio_param { + remote_nonnull_string field; + remote_blkio_param_value value; +}; struct remote_memory_param_value { int type; union { @@ -172,6 +187,26 @@ struct remote_domain_set_scheduler_parameters_args { remote_sched_param * params_val; } params; }; +struct remote_domain_set_blkio_parameters_args { + remote_nonnull_domain dom; + struct { + u_int params_len; + remote_blkio_param *params_val; + } params; + u_int flags; +}; +struct remote_domain_get_blkio_parameters_args { + remote_nonnull_domain dom; + int nparams; + u_int flags; +}; +struct remote_domain_get_blkio_parameters_ret { + struct { + u_int params_len; + remote_blkio_param *params_val; + } params; + int nparams; +}; struct remote_domain_set_memory_parameters_args { remote_nonnull_domain dom; struct { -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list