Well, the remaining drivers that already had the get/set
scheduler parameter functionality to begin with.
For now, this blindly treats VIR_DOMAIN_SCHEDINFO_CURRENT as
the only supported operation for these 5 domains; it will
take domain-specific patches if more specific behavior is
preferred.
* src/esx/esx_driver.c (esxDomainGetSchedulerParameters)
(esxDomainSetSchedulerParameters): Move guts...
(esxDomainGetSchedulerParametersFlags)
(esxDomainSetSchedulerParametersFlags): ...to new functions.
* src/libxl/libxl_driver.c (libxlDomainGetSchedulerParameters)
(libxlDomainSetSchedulerParameters)
(libxlDomainGetSchedulerParametersFlags)
(libxlDomainSetSchedulerParametersFlags): Likewise.
* src/lxc/lxc_driver.c (lxcGetSchedulerParameters)
(lxcSetSchedulerParameters, lxcGetSchedulerParametersFlags)
(lxcSetSchedulerParametersFlags): Likewise.
* src/test/test_driver.c (testDomainGetSchedulerParams)
(testDomainSetSchedulerParams, testDomainGetSchedulerParamsFlags)
(testDomainSetSchedulerParamsFlags): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainGetSchedulerParameters)
(xenUnifiedDomainSetSchedulerParameters)
(xenUnifiedDomainGetSchedulerParametersFlags)
(xenUnifiedDomainSetSchedulerParametersFlags): Likewise.
---
src/esx/esx_driver.c | 28 ++++++++++++++++++++++++----
src/libxl/libxl_driver.c | 32 ++++++++++++++++++++++++++++----
src/lxc/lxc_driver.c | 38 ++++++++++++++++++++++++++++++++------
src/test/test_driver.c | 37 +++++++++++++++++++++++++++++++------
src/xen/xen_driver.c | 38 ++++++++++++++++++++++++++++++++------
5 files changed, 147 insertions(+), 26 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 89df457..64c51a7 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -3532,8 +3532,9 @@ esxDomainGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUSED, int
*nparams)
static int
-esxDomainGetSchedulerParameters(virDomainPtr domain,
- virTypedParameterPtr params, int *nparams)
+esxDomainGetSchedulerParametersFlags(virDomainPtr domain,
+ virTypedParameterPtr params, int *nparams,
+ unsigned int flags)
{
int result = -1;
esxPrivate *priv = domain->conn->privateData;
@@ -3544,6 +3545,8 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
unsigned int mask = 0;
int i = 0;
+ virCheckFlags(0, -1);
+
if (*nparams < 3) {
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
_("Parameter array must have space for 3 items"));
@@ -3654,11 +3657,18 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
return result;
}
+static int
+esxDomainGetSchedulerParameters(virDomainPtr domain,
+ virTypedParameterPtr params, int *nparams)
+{
+ return esxDomainGetSchedulerParametersFlags(domain, params, nparams, 0);
+}
static int
-esxDomainSetSchedulerParameters(virDomainPtr domain,
- virTypedParameterPtr params, int nparams)
+esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
+ virTypedParameterPtr params, int nparams,
+ unsigned int flags)
{
int result = -1;
esxPrivate *priv = domain->conn->privateData;
@@ -3670,6 +3680,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
char *taskInfoErrorMessage = NULL;
int i;
+ virCheckFlags(0, -1);
+
if (esxVI_EnsureSession(priv->primary) < 0) {
return -1;
}
@@ -3785,6 +3797,12 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
return result;
}
+static int
+esxDomainSetSchedulerParameters(virDomainPtr domain,
+ virTypedParameterPtr params, int nparams)
+{
+ return esxDomainSetSchedulerParametersFlags(domain, params, nparams, 0);
+}
static int
@@ -4684,7 +4702,9 @@ static virDriver esxDriver = {
.domainSetAutostart = esxDomainSetAutostart, /* 0.9.0 */
.domainGetSchedulerType = esxDomainGetSchedulerType, /* 0.7.0 */
.domainGetSchedulerParameters = esxDomainGetSchedulerParameters, /* 0.7.0 */
+ .domainGetSchedulerParametersFlags = esxDomainGetSchedulerParametersFlags, /* 0.9.2
*/
.domainSetSchedulerParameters = esxDomainSetSchedulerParameters, /* 0.7.0 */
+ .domainSetSchedulerParametersFlags = esxDomainSetSchedulerParametersFlags, /* 0.9.2
*/
.domainMigratePrepare = esxDomainMigratePrepare, /* 0.7.0 */
.domainMigratePerform = esxDomainMigratePerform, /* 0.7.0 */
.domainMigrateFinish = esxDomainMigrateFinish, /* 0.7.0 */
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 492f61a..312d414 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2950,8 +2950,10 @@ cleanup:
}
static int
-libxlDomainGetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params,
- int *nparams)
+libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags)
{
libxlDriverPrivatePtr driver = dom->conn->privateData;
libxlDomainObjPrivatePtr priv;
@@ -2960,6 +2962,8 @@ libxlDomainGetSchedulerParameters(virDomainPtr dom,
virTypedParameterPtr params,
int sched_id;
int ret = -1;
+ virCheckFlags(0, -1);
+
libxlDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
libxlDriverUnlock(driver);
@@ -3027,8 +3031,17 @@ cleanup:
}
static int
-libxlDomainSetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params,
- int nparams)
+libxlDomainGetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params,
+ int *nparams)
+{
+ return libxlDomainGetSchedulerParametersFlags(dom, params, nparams, 0);
+}
+
+static int
+libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
{
libxlDriverPrivatePtr driver = dom->conn->privateData;
libxlDomainObjPrivatePtr priv;
@@ -3038,6 +3051,8 @@ libxlDomainSetSchedulerParameters(virDomainPtr dom,
virTypedParameterPtr params,
int i;
int ret = -1;
+ virCheckFlags(0, -1);
+
libxlDriverLock(driver);
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
libxlDriverUnlock(driver);
@@ -3115,6 +3130,13 @@ cleanup:
}
static int
+libxlDomainSetSchedulerParameters(virDomainPtr dom, virTypedParameterPtr params,
+ int nparams)
+{
+ return libxlDomainSetSchedulerParametersFlags(dom, params, nparams, 0);
+}
+
+static int
libxlDomainIsActive(virDomainPtr dom)
{
libxlDriverPrivatePtr driver = dom->conn->privateData;
@@ -3266,7 +3288,9 @@ static virDriver libxlDriver = {
.domainSetAutostart = libxlDomainSetAutostart, /* 0.9.0 */
.domainGetSchedulerType = libxlDomainGetSchedulerType, /* 0.9.0 */
.domainGetSchedulerParameters = libxlDomainGetSchedulerParameters, /* 0.9.0 */
+ .domainGetSchedulerParametersFlags = libxlDomainGetSchedulerParametersFlags, /* 0.9.2
*/
.domainSetSchedulerParameters = libxlDomainSetSchedulerParameters, /* 0.9.0 */
+ .domainSetSchedulerParametersFlags = libxlDomainSetSchedulerParametersFlags, /* 0.9.2
*/
.nodeGetFreeMemory = libxlNodeGetFreeMemory, /* 0.9.0 */
.domainEventRegister = libxlDomainEventRegister, /* 0.9.0 */
.domainEventDeregister = libxlDomainEventDeregister, /* 0.9.0 */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 00e3f2a..6ee13da 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2161,9 +2161,11 @@ static char *lxcGetSchedulerType(virDomainPtr domain
ATTRIBUTE_UNUSED,
return schedulerType;
}
-static int lxcSetSchedulerParameters(virDomainPtr domain,
- virTypedParameterPtr params,
- int nparams)
+static int
+lxcSetSchedulerParametersFlags(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
{
lxc_driver_t *driver = domain->conn->privateData;
int i;
@@ -2171,6 +2173,8 @@ static int lxcSetSchedulerParameters(virDomainPtr domain,
virDomainObjPtr vm = NULL;
int ret = -1;
+ virCheckFlags(0, -1);
+
if (driver->cgroup == NULL)
return -1;
@@ -2222,9 +2226,19 @@ cleanup:
return ret;
}
-static int lxcGetSchedulerParameters(virDomainPtr domain,
- virTypedParameterPtr params,
- int *nparams)
+static int
+lxcSetSchedulerParameters(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams)
+{
+ return lxcSetSchedulerParametersFlags(domain, params, nparams, 0);
+}
+
+static int
+lxcGetSchedulerParametersFlags(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags)
{
lxc_driver_t *driver = domain->conn->privateData;
virCgroupPtr group = NULL;
@@ -2232,6 +2246,8 @@ static int lxcGetSchedulerParameters(virDomainPtr domain,
unsigned long long val;
int ret = -1;
+ virCheckFlags(0, -1);
+
if (driver->cgroup == NULL)
return -1;
@@ -2276,6 +2292,14 @@ cleanup:
return ret;
}
+static int
+lxcGetSchedulerParameters(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams)
+{
+ return lxcGetSchedulerParametersFlags(domain, params, nparams, 0);
+}
+
#ifdef __linux__
static int
lxcDomainInterfaceStats(virDomainPtr dom,
@@ -2752,7 +2776,9 @@ static virDriver lxcDriver = {
.domainSetAutostart = lxcDomainSetAutostart, /* 0.7.0 */
.domainGetSchedulerType = lxcGetSchedulerType, /* 0.5.0 */
.domainGetSchedulerParameters = lxcGetSchedulerParameters, /* 0.5.0 */
+ .domainGetSchedulerParametersFlags = lxcGetSchedulerParametersFlags, /* 0.9.2 */
.domainSetSchedulerParameters = lxcSetSchedulerParameters, /* 0.5.0 */
+ .domainSetSchedulerParametersFlags = lxcSetSchedulerParametersFlags, /* 0.9.2 */
.domainInterfaceStats = lxcDomainInterfaceStats, /* 0.7.3 */
.nodeGetCellsFreeMemory = nodeGetCellsFreeMemory, /* 0.6.5 */
.nodeGetFreeMemory = nodeGetFreeMemory, /* 0.6.5 */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index f1cc681..7cf8eab 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -2634,14 +2634,18 @@ static char *testDomainGetSchedulerType(virDomainPtr domain
ATTRIBUTE_UNUSED,
return type;
}
-static int testDomainGetSchedulerParams(virDomainPtr domain,
- virTypedParameterPtr params,
- int *nparams)
+static int
+testDomainGetSchedulerParamsFlags(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags)
{
testConnPtr privconn = domain->conn->privateData;
virDomainObjPtr privdom;
int ret = -1;
+ virCheckFlags(0, -1);
+
testDriverLock(privconn);
privdom = virDomainFindByName(&privconn->domains,
domain->name);
@@ -2671,15 +2675,26 @@ cleanup:
return ret;
}
+static int
+testDomainGetSchedulerParams(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int *nparams)
+{
+ return testDomainGetSchedulerParamsFlags(domain, params, nparams, 0);
+}
-static int testDomainSetSchedulerParams(virDomainPtr domain,
- virTypedParameterPtr params,
- int nparams)
+static int
+testDomainSetSchedulerParamsFlags(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
{
testConnPtr privconn = domain->conn->privateData;
virDomainObjPtr privdom;
int ret = -1, i;
+ virCheckFlags(0, -1);
+
testDriverLock(privconn);
privdom = virDomainFindByName(&privconn->domains,
domain->name);
@@ -2711,6 +2726,14 @@ cleanup:
return ret;
}
+static int
+testDomainSetSchedulerParams(virDomainPtr domain,
+ virTypedParameterPtr params,
+ int nparams)
+{
+ return testDomainSetSchedulerParamsFlags(domain, params, nparams, 0);
+}
+
static int testDomainBlockStats(virDomainPtr domain,
const char *path,
struct _virDomainBlockStats *stats)
@@ -5374,7 +5397,9 @@ static virDriver testDriver = {
.domainSetAutostart = testDomainSetAutostart, /* 0.3.2 */
.domainGetSchedulerType = testDomainGetSchedulerType, /* 0.3.2 */
.domainGetSchedulerParameters = testDomainGetSchedulerParams, /* 0.3.2 */
+ .domainGetSchedulerParametersFlags = testDomainGetSchedulerParamsFlags, /* 0.9.2 */
.domainSetSchedulerParameters = testDomainSetSchedulerParams, /* 0.3.2 */
+ .domainSetSchedulerParametersFlags = testDomainSetSchedulerParamsFlags, /* 0.9.2 */
.domainBlockStats = testDomainBlockStats, /* 0.7.0 */
.domainInterfaceStats = testDomainInterfaceStats, /* 0.7.0 */
.nodeGetCellsFreeMemory = testNodeGetCellsFreeMemory, /* 0.4.2 */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index f527a7a..88febba 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1676,13 +1676,16 @@ xenUnifiedDomainGetSchedulerType (virDomainPtr dom, int *nparams)
}
static int
-xenUnifiedDomainGetSchedulerParameters (virDomainPtr dom,
- virTypedParameterPtr params,
- int *nparams)
+xenUnifiedDomainGetSchedulerParametersFlags(virDomainPtr dom,
+ virTypedParameterPtr params,
+ int *nparams,
+ unsigned int flags)
{
GET_PRIVATE(dom->conn);
int i, ret;
+ virCheckFlags(0, -1);
+
for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) {
if (priv->opened[i] && drivers[i]->domainGetSchedulerParameters) {
ret = drivers[i]->domainGetSchedulerParameters(dom, params, nparams);
@@ -1694,13 +1697,25 @@ xenUnifiedDomainGetSchedulerParameters (virDomainPtr dom,
}
static int
-xenUnifiedDomainSetSchedulerParameters (virDomainPtr dom,
- virTypedParameterPtr params,
- int nparams)
+xenUnifiedDomainGetSchedulerParameters(virDomainPtr dom,
+ virTypedParameterPtr params,
+ int *nparams)
+{
+ return xenUnifiedDomainGetSchedulerParametersFlags(dom, params,
+ nparams, 0);
+}
+
+static int
+xenUnifiedDomainSetSchedulerParametersFlags(virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams,
+ unsigned int flags)
{
GET_PRIVATE(dom->conn);
int i, ret;
+ virCheckFlags(0, -1);
+
/* do the hypervisor call last to get better error */
for (i = XEN_UNIFIED_NR_DRIVERS - 1; i >= 0; i--) {
if (priv->opened[i] && drivers[i]->domainSetSchedulerParameters) {
@@ -1714,6 +1729,15 @@ xenUnifiedDomainSetSchedulerParameters (virDomainPtr dom,
}
static int
+xenUnifiedDomainSetSchedulerParameters(virDomainPtr dom,
+ virTypedParameterPtr params,
+ int nparams)
+{
+ return xenUnifiedDomainSetSchedulerParametersFlags(dom, params,
+ nparams, 0);
+}
+
+static int
xenUnifiedDomainBlockStats (virDomainPtr dom, const char *path,
struct _virDomainBlockStats *stats)
{
@@ -2197,7 +2221,9 @@ static virDriver xenUnifiedDriver = {
.domainSetAutostart = xenUnifiedDomainSetAutostart, /* 0.4.4 */
.domainGetSchedulerType = xenUnifiedDomainGetSchedulerType, /* 0.2.3 */
.domainGetSchedulerParameters = xenUnifiedDomainGetSchedulerParameters, /* 0.2.3 */
+ .domainGetSchedulerParametersFlags = xenUnifiedDomainGetSchedulerParametersFlags, /*
0.9.2 */
.domainSetSchedulerParameters = xenUnifiedDomainSetSchedulerParameters, /* 0.2.3 */
+ .domainSetSchedulerParametersFlags = xenUnifiedDomainSetSchedulerParametersFlags, /*
0.9.2 */
.domainMigratePrepare = xenUnifiedDomainMigratePrepare, /* 0.3.2 */
.domainMigratePerform = xenUnifiedDomainMigratePerform, /* 0.3.2 */
.domainMigrateFinish = xenUnifiedDomainMigrateFinish, /* 0.3.2 */
--
1.7.4.4