[libvirt] [PATCH v4 13/13] Remote protocol changes and implements virDomainSet/GetMemoryParameters

Daniel Veillard veillard at redhat.com
Tue Oct 12 17:27:05 UTC 2010


On Fri, Oct 08, 2010 at 05:47:03PM +0530, Nikunj A. Dadhania wrote:
> From: Nikunj A. Dadhania <nikunj at linux.vnet.ibm.com>
> 
> v4:
> * prototype change: add unsigned int flags, regenerate files
> 
> 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
> 
> Acked-by: "Daniel P. Berrange" <berrange at redhat.com>
> Signed-off-by: Nikunj A. Dadhania <nikunj at linux.vnet.ibm.com>
[...]
>  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;
> +    unsigned int flags;
> +
> +    nparams = args->params.params_len;
> +    nparams = args->flags;

  obvious bug: flags = args->flags;

That reminds me that I didn't see flags being checked against 0 on the
QEmu and LXC drivers, we should check them !

> +    if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
> +        remoteDispatchFormatError (rerr, "%s", _("nparams too large"));
> +        return -1;

  I did a lot of reformating and code cleanups in the non-generated
  files, to try to keep the source readable on a 80 columns editor.

> diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
> index 8af469c..f5dcb5c 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;
> +

  Hopefully we won't exhaust that crucial limit

>  /* 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,23 @@ 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>;
> +    unsigned int flags;
> +};
> +
> +struct remote_domain_get_memory_parameters_args {
> +    remote_nonnull_domain dom;
> +    int nparams;
> +    unsigned int flags;
> +};
> +
> +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 +2060,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 ?

  With that done, I think I can ACK the whole serie, and pushed it, but
there is still a number of small TODOs for which I would appreciate
patches,

  thanks a lot !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list