[libvirt] [PATCH 5/6] remote-protocol: Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters.
Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters. Signed-off-by: Gui Jianfeng --- 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 +++- 9 files changed, 597 insertions(+), 3 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index d53b466..b8e79f9 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, +
[libvirt] [PATCH 5/6] remote-protocol: Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters.
Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters. Signed-off-by: Gui Jianfeng --- 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 +++- 9 files changed, 597 insertions(+), 3 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index d53b466..b8e79f9 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, +
Re: [libvirt] [PATCH 5/6] remote-protocol: Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters.
On 02/21/2011 02:28 AM, Gui Jianfeng wrote: > Remote protocol implementation of virDomainSetBlkioParameters and > virDomainGetBlkioParameters. > > Signed-off-by: Gui Jianfeng > --- > 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 +++- > 9 files changed, 597 insertions(+), 3 deletions(-) If you will install the dwarves package for pdwtags, then 'make check' will alert you to the fact that you also need to patch src/remote_protocol-structs to make it clear that the API is pure addition. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 5/6] remote-protocol: Remote protocol implementation of virDomainSetBlkioParameters and virDomainGetBlkioParameters.
Thanks Eric, Will update. Gui Eric Blake wrote: > On 02/21/2011 02:28 AM, Gui Jianfeng wrote: >> Remote protocol implementation of virDomainSetBlkioParameters and >> virDomainGetBlkioParameters. >> >> Signed-off-by: Gui Jianfeng >> --- >> 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 +++- >> 9 files changed, 597 insertions(+), 3 deletions(-) > > If you will install the dwarves package for pdwtags, then 'make check' > will alert you to the fact that you also need to patch > src/remote_protocol-structs to make it clear that the API is pure addition. > -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list