This new function allows aditional flags to be passed into from
the virsh command line.
---
include/libvirt/libvirt.h.in | 14 +++++++++
python/generator.py | 1 +
src/driver.h | 8 +++++
src/libvirt.c | 64 ++++++++++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 1 +
5 files changed, 88 insertions(+), 0 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index f4d0b40..ec32b4b 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -295,6 +295,12 @@ typedef enum {
VIR_DOMAIN_SCHED_FIELD_BOOLEAN = 6 /* boolean(character) case */
} virSchedParameterType;
+typedef enum {
+ VIR_DOMAIN_SCHEDPARAM_CURRENT = (1 << 0), /* affect current domain state */
+ VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 1), /* Affect active domain */
+ VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 2), /* Affect next boot */
+} virDomainSchedParameterFlags;
+
/**
* VIR_DOMAIN_SCHED_FIELD_LENGTH:
*
@@ -346,6 +352,14 @@ int virDomainSetSchedulerParameters (virDomainPtr domain,
virSchedParameterPtr params,
int nparams);
+/*
+ * Change scheduler parameters
+ */
+int virDomainSetSchedulerParametersFlags (virDomainPtr domain,
+ virSchedParameterPtr params,
+ int nparams,
+ unsigned int flags);
+
/**
* virDomainBlockStats:
*
diff --git a/python/generator.py b/python/generator.py
index b395caf..9f9deb2 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -312,6 +312,7 @@ skip_impl = (
'virDomainGetSchedulerType',
'virDomainGetSchedulerParameters',
'virDomainSetSchedulerParameters',
+ 'virDomainSetSchedulerParametersFlags',
'virDomainSetBlkioParameters',
'virDomainGetBlkioParameters',
'virDomainSetMemoryParameters',
diff --git a/src/driver.h b/src/driver.h
index 006e0bb..450dd53 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -286,6 +286,13 @@ typedef int
int nparams);
typedef int
+ (*virDrvDomainSetSchedulerParametersFlags)
+ (virDomainPtr domain,
+ virSchedParameterPtr params,
+ int nparams,
+ unsigned int flags);
+
+typedef int
(*virDrvDomainBlockStats)
(virDomainPtr domain,
const char *path,
@@ -677,6 +684,7 @@ struct _virDriver {
virDrvDomainGetSchedulerType domainGetSchedulerType;
virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
+ virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
virDrvDomainMigratePrepare domainMigratePrepare;
virDrvDomainMigratePerform domainMigratePerform;
virDrvDomainMigrateFinish domainMigrateFinish;
diff --git a/src/libvirt.c b/src/libvirt.c
index 5a5439d..9684b83 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5104,6 +5104,70 @@ error:
/**
+ * virDomainSetSchedulerParametersFlags:
+ * @domain: pointer to domain object
+ * @params: pointer to scheduler parameter objects
+ * @nparams: number of scheduler parameter
+ * (this value should be same or less than the returned value
+ * nparams of virDomainGetSchedulerType)
+ * @flags: virDomainSchedParameterFlags
+ *
+ * Change the scheduler parameters
+ *
+ * Returns -1 in case of error, 0 in case of success.
+ */
+int
+virDomainSetSchedulerParametersFlags(virDomainPtr domain,
+ virSchedParameterPtr params,
+ int nparams,
+ unsigned int flags)
+{
+ virConnectPtr conn;
+
+ VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d, flags=%u",
+ params, nparams, flags);
+
+ virResetLastError();
+
+ if (!(flags & (VIR_DOMAIN_SCHEDPARAM_LIVE |
+ VIR_DOMAIN_SCHEDPARAM_CONFIG |
+ VIR_DOMAIN_SCHEDPARAM_CURRENT))) {
+ virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virDispatchError(NULL);
+ return -1;
+ }
+
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+ virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ virDispatchError(NULL);
+ return -1;
+ }
+ if (domain->conn->flags & VIR_CONNECT_RO) {
+ virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ goto error;
+ }
+ conn = domain->conn;
+
+ if (conn->driver->domainSetSchedulerParametersFlags) {
+ int ret;
+ ret = conn->driver->domainSetSchedulerParametersFlags(domain,
+ params,
+ nparams,
+ flags);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+ virDispatchError(domain->conn);
+ return -1;
+}
+
+
+/**
* virDomainBlockStats:
* @dom: pointer to the domain object
* @path: path to the block device
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 1444b55..0590535 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -441,6 +441,7 @@ LIBVIRT_0.9.2 {
virDomainGetState;
virDomainInjectNMI;
virDomainScreenshot;
+ virDomainSetSchedulerParametersFlags;
} LIBVIRT_0.9.0;
# .... define new API here using predicted next version number ....
--
1.7.3.1