On 11/02/2011 02:00 PM, Eric Blake wrote:
Allow the user to call with nparams too small, per API documentation. Also, libvirt.c filters out nparams of 0 for scheduler parameters. * src/lxc/lxc_driver.c (lxcDomainGetMemoryParameters): Allow fewer than max. (lxcGetSchedulerParametersFlags): Drop redundant check. --- src/lxc/lxc_driver.c | 16 +++------------- 1 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 9c89c41..4096626 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -901,11 +901,6 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, ret = 0; goto cleanup; } - if ((*nparams)< LXC_NB_MEM_PARAM) { - lxcError(VIR_ERR_INVALID_ARG, - "%s", _("Invalid parameter count")); - goto cleanup; - } if (virCgroupForDomain(driver->cgroup, vm->def->name,&cgroup, 0) != 0) { lxcError(VIR_ERR_INTERNAL_ERROR, @@ -913,7 +908,7 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, goto cleanup; } - for (i = 0; i< LXC_NB_MEM_PARAM; i++) { + for (i = 0; i< LXC_NB_MEM_PARAM&& i< *nparams; i++) { virTypedParameterPtr param =¶ms[i]; val = 0; param->value.ul = 0; @@ -971,7 +966,8 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom, } } - *nparams = LXC_NB_MEM_PARAM; + if (*nparams> LXC_NB_MEM_PARAM) + *nparams = LXC_NB_MEM_PARAM;
OK. Caps number of returned parameters to '3'.
ret = 0; cleanup: @@ -2580,12 +2576,6 @@ lxcGetSchedulerParametersFlags(virDomainPtr domain, if (driver->cgroup == NULL) return -1; - if (*nparams< 1) { - lxcError(VIR_ERR_INVALID_ARG, - "%s", _("Invalid parameter count")); - return -1; - } -
Ok with number of schedule parameters not being zero.
lxcDriverLock(driver); vm = virDomainFindByUUID(&driver->domains, domain->uuid);
ACK -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list