69 lines
2.7 KiB
Diff
69 lines
2.7 KiB
Diff
|
commit 849052ec61e18780713bec171748e859e32dfd6d
|
||
|
Author: Dario Faggioli <dfaggioli@suse.com>
|
||
|
Date: Wed Jan 29 12:05:15 2020 +0100
|
||
|
|
||
|
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>
|
||
|
|
||
|
Index: libvirt-6.0.0/src/libxl/libxl_driver.c
|
||
|
===================================================================
|
||
|
--- libvirt-6.0.0.orig/src/libxl/libxl_driver.c
|
||
|
+++ libvirt-6.0.0/src/libxl/libxl_driver.c
|
||
|
@@ -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) \
|
||
|
@@ -4579,6 +4579,8 @@ libxlDomainGetSchedulerType(virDomainPtr
|
||
|
break;
|
||
|
case LIBXL_SCHEDULER_CREDIT2:
|
||
|
name = "credit2";
|
||
|
+ if (nparams)
|
||
|
+ *nparams = XEN_SCHED_CREDIT_NPARAM;
|
||
|
break;
|
||
|
case LIBXL_SCHEDULER_ARINC653:
|
||
|
name = "arinc653";
|
||
|
@@ -4625,11 +4627,11 @@ libxlDomainGetSchedulerParametersFlags(v
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
@@ -4702,11 +4704,11 @@ libxlDomainSetSchedulerParametersFlags(v
|
||
|
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;
|
||
|
}
|
||
|
|