mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
libxl: allow getting < max typed parameters
Allow the user to call with nparams too small, per API documentation. * src/libxl/libxl_driver.c (libxlDomainGetSchedulerParametersFlags): Allow fewer than max.
This commit is contained in:
parent
6b98a4b2e6
commit
1367954702
@ -3631,11 +3631,6 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*nparams < XEN_SCHED_CREDIT_NPARAM) {
|
|
||||||
libxlError(VIR_ERR_INVALID_ARG, "%s", _("Invalid parameter count"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) {
|
if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) {
|
||||||
libxlError(VIR_ERR_INTERNAL_ERROR,
|
libxlError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Failed to get scheduler parameters for domain '%d'"
|
_("Failed to get scheduler parameters for domain '%d'"
|
||||||
@ -3653,16 +3648,20 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
params[1].value.ui = sc_info.cap;
|
if (*nparams > 1) {
|
||||||
params[1].type = VIR_TYPED_PARAM_UINT;
|
params[1].value.ui = sc_info.cap;
|
||||||
if (virStrcpyStatic(params[1].field, VIR_DOMAIN_SCHEDULER_CAP) == NULL) {
|
params[1].type = VIR_TYPED_PARAM_UINT;
|
||||||
libxlError(VIR_ERR_INTERNAL_ERROR,
|
if (virStrcpyStatic(params[1].field,
|
||||||
_("Field name '%s' too long"),
|
VIR_DOMAIN_SCHEDULER_CAP) == NULL) {
|
||||||
VIR_DOMAIN_SCHEDULER_CAP);
|
libxlError(VIR_ERR_INTERNAL_ERROR,
|
||||||
goto cleanup;
|
_("Field name '%s' too long"),
|
||||||
|
VIR_DOMAIN_SCHEDULER_CAP);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*nparams = XEN_SCHED_CREDIT_NPARAM;
|
if (*nparams > XEN_SCHED_CREDIT_NPARAM)
|
||||||
|
*nparams = XEN_SCHED_CREDIT_NPARAM;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
Reference in New Issue
Block a user