mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
lxc: allow getting < max typed parameters
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.
This commit is contained in:
parent
1367954702
commit
f4e584decf
@ -901,11 +901,6 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
goto cleanup;
|
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) {
|
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -913,7 +908,7 @@ static int lxcDomainGetMemoryParameters(virDomainPtr dom,
|
|||||||
goto cleanup;
|
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];
|
virTypedParameterPtr param = ¶ms[i];
|
||||||
val = 0;
|
val = 0;
|
||||||
param->value.ul = 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;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -2580,12 +2576,6 @@ lxcGetSchedulerParametersFlags(virDomainPtr domain,
|
|||||||
if (driver->cgroup == NULL)
|
if (driver->cgroup == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (*nparams < 1) {
|
|
||||||
lxcError(VIR_ERR_INVALID_ARG,
|
|
||||||
"%s", _("Invalid parameter count"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
lxcDriverLock(driver);
|
lxcDriverLock(driver);
|
||||||
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
|
vm = virDomainFindByUUID(&driver->domains, domain->uuid);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user