mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
libxl: support getting and setting parameters for the Credit2
With Credit2 being Xen default scheduler, it's definitely the case to allow Credit2's scheduling parameters to be get and set via libvirt. This is easy, as Credit and Credit2 have (at least as of now) the very same parameters ('weight' and 'cap'). So we can just let credit2 pass the scheduler-type check and the same code will work for both. Signed-off-by: Dario Faggioli <dfaggioli@suse.com> Reviewed-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
parent
f0f34056ab
commit
849052ec61
@ -73,7 +73,7 @@ VIR_LOG_INIT("libxl.libxl_driver");
|
||||
#define HYPERVISOR_CAPABILITIES "/proc/xen/capabilities"
|
||||
#define HYPERVISOR_XENSTORED "/dev/xen/xenstored"
|
||||
|
||||
/* Number of Xen scheduler parameters */
|
||||
/* Number of Xen scheduler parameters. credit and credit2 both support 2 */
|
||||
#define XEN_SCHED_CREDIT_NPARAM 2
|
||||
|
||||
#define LIBXL_CHECK_DOM0_GOTO(name, label) \
|
||||
@ -4586,6 +4586,8 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
|
||||
break;
|
||||
case LIBXL_SCHEDULER_CREDIT2:
|
||||
name = "credit2";
|
||||
if (nparams)
|
||||
*nparams = XEN_SCHED_CREDIT_NPARAM;
|
||||
break;
|
||||
case LIBXL_SCHEDULER_ARINC653:
|
||||
name = "arinc653";
|
||||
@ -4632,11 +4634,11 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
|
||||
if (virDomainObjCheckActive(vm) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Only credit and credit2 are supported for now. */
|
||||
sched_id = libxl_get_scheduler(cfg->ctx);
|
||||
|
||||
if (sched_id != LIBXL_SCHEDULER_CREDIT) {
|
||||
if (sched_id != LIBXL_SCHEDULER_CREDIT && sched_id != LIBXL_SCHEDULER_CREDIT2) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Only 'credit' scheduler is supported"));
|
||||
_("Only 'credit' and 'credit2' schedulers are supported"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -4709,11 +4711,11 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
|
||||
if (virDomainObjCheckActive(vm) < 0)
|
||||
goto endjob;
|
||||
|
||||
/* Only credit and credit2 are supported for now. */
|
||||
sched_id = libxl_get_scheduler(cfg->ctx);
|
||||
|
||||
if (sched_id != LIBXL_SCHEDULER_CREDIT) {
|
||||
if (sched_id != LIBXL_SCHEDULER_CREDIT && sched_id != LIBXL_SCHEDULER_CREDIT2) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Only 'credit' scheduler is supported"));
|
||||
_("Only 'credit' and 'credit2' schedulers are supported"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user