On Tue, Oct 12, 2010 at 07:27:05PM +0200, Daniel Veillard wrote:
On Fri, Oct 08, 2010 at 05:47:03PM +0530, Nikunj A. Dadhania wrote:
> From: Nikunj A. Dadhania <nikunj(a)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(a)redhat.com>
> Signed-off-by: Nikunj A. Dadhania <nikunj(a)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
That limit isn't ABI critical. It is simply to prevent DOS when
de-marshalling data, so we can raise it at will in the future.
Regards,
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|