[PATCH 1/4] introduce virDomainSetSchedulerParametersFlags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This new function allows aditional flags to be passed into from
the virsh command line.
---
 include/libvirt/libvirt.h.in |   13 +++++++++
 python/generator.py          |    1 +
 src/driver.h                 |    8 +++++
 src/esx/esx_driver.c         |    1 +
 src/libvirt.c                |   62 ++++++++++++++++++++++++++++++++++++++++++
 src/libvirt_public.syms      |    5 +++
 src/libxl/libxl_driver.c     |    1 +
 src/lxc/lxc_driver.c         |    1 +
 src/openvz/openvz_driver.c   |    1 +
 src/phyp/phyp_driver.c       |    1 +
 src/qemu/qemu_driver.c       |    1 +
 src/remote/remote_driver.c   |    1 +
 src/test/test_driver.c       |    1 +
 src/uml/uml_driver.c         |    1 +
 src/vbox/vbox_tmpl.c         |    1 +
 src/vmware/vmware_driver.c   |    1 +
 src/xen/xen_driver.c         |    1 +
 src/xenapi/xenapi_driver.c   |    1 +
 18 files changed, 102 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 5783303..2c38118 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -243,6 +243,11 @@ typedef enum {
     VIR_DOMAIN_SCHED_FIELD_BOOLEAN = 6  /* boolean(character) case */
 } virSchedParameterType;
 
+typedef enum {
+    VIR_DOMAIN_SCHEDPARAM_LIVE    = (1 << 0), /* Affect active domain */
+    VIR_DOMAIN_SCHEDPARAM_CONFIG  = (1 << 1), /* Affect next boot */
+} virDomainSchedParameterFlags;
+
 /**
  * VIR_DOMAIN_SCHED_FIELD_LENGTH:
  *
@@ -294,6 +299,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 4fa4f65..a44a4d0 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -311,6 +311,7 @@ skip_impl = (
     'virDomainGetSchedulerType',
     'virDomainGetSchedulerParameters',
     'virDomainSetSchedulerParameters',
+    'virDomainSetSchedulerParametersFlags',
     'virDomainSetBlkioParameters',
     'virDomainGetBlkioParameters',
     'virDomainSetMemoryParameters',
diff --git a/src/driver.h b/src/driver.h
index a8b79e6..3347a53 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -276,6 +276,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,
@@ -593,6 +600,7 @@ struct _virDriver {
     virDrvDomainGetSchedulerType	domainGetSchedulerType;
     virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
     virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
+    virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
     virDrvDomainMigratePrepare	domainMigratePrepare;
     virDrvDomainMigratePerform	domainMigratePerform;
     virDrvDomainMigrateFinish	domainMigrateFinish;
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index 7933f11..181d6aa 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -4653,6 +4653,7 @@ static virDriver esxDriver = {
     esxDomainGetSchedulerType,       /* domainGetSchedulerType */
     esxDomainGetSchedulerParameters, /* domainGetSchedulerParameters */
     esxDomainSetSchedulerParameters, /* domainSetSchedulerParameters */
+    NULL,                            /* domainSetSchedulerParametersFlags */
     esxDomainMigratePrepare,         /* domainMigratePrepare */
     esxDomainMigratePerform,         /* domainMigratePerform */
     esxDomainMigrateFinish,          /* domainMigrateFinish */
diff --git a/src/libvirt.c b/src/libvirt.c
index e74e977..92e804e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4409,6 +4409,68 @@ 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))) {
+        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 b4aed41..03d08f1 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -436,4 +436,9 @@ LIBVIRT_0.9.0 {
         virStorageVolUpload;
 } LIBVIRT_0.8.8;
 
+LIBVIRT_0.9.1 {
+    global:
+        virDomainSetSchedulerParametersFlags;
+} LIBVIRT_0.9.0;
+
 # .... define new API here using predicted next version number ....
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index dec4f43..270bef9 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2700,6 +2700,7 @@ static virDriver libxlDriver = {
     libxlDomainGetSchedulerType,/* domainGetSchedulerType */
     libxlDomainGetSchedulerParameters,/* domainGetSchedulerParameters */
     libxlDomainSetSchedulerParameters,/* domainSetSchedulerParameters */
+    NULL,                       /* domainSetSchedulerParametersFlags */
     NULL,                       /* domainMigratePrepare */
     NULL,                       /* domainMigratePerform */
     NULL,                       /* domainMigrateFinish */
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index b94941d..e8afcd3 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2859,6 +2859,7 @@ static virDriver lxcDriver = {
     lxcGetSchedulerType, /* domainGetSchedulerType */
     lxcGetSchedulerParameters, /* domainGetSchedulerParameters */
     lxcSetSchedulerParameters, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     NULL, /* domainMigratePrepare */
     NULL, /* domainMigratePerform */
     NULL, /* domainMigrateFinish */
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 0bd007a..1c11e73 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -1621,6 +1621,7 @@ static virDriver openvzDriver = {
     NULL, /* domainGetSchedulerType */
     NULL, /* domainGetSchedulerParameters */
     NULL, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     NULL, /* domainMigratePrepare */
     NULL, /* domainMigratePerform */
     NULL, /* domainMigrateFinish */
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 30d4adf..d2f30d2 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -3782,6 +3782,7 @@ static virDriver phypDriver = {
     NULL,                       /* domainGetSchedulerType */
     NULL,                       /* domainGetSchedulerParameters */
     NULL,                       /* domainSetSchedulerParameters */
+    NULL,                       /* domainSetSchedulerParametersFlags */
     NULL,                       /* domainMigratePrepare */
     NULL,                       /* domainMigratePerform */
     NULL,                       /* domainMigrateFinish */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dd89786..15c5744 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7148,6 +7148,7 @@ static virDriver qemuDriver = {
     qemuGetSchedulerType, /* domainGetSchedulerType */
     qemuGetSchedulerParameters, /* domainGetSchedulerParameters */
     qemuSetSchedulerParameters, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     NULL, /* domainMigratePrepare (v1) */
     qemudDomainMigratePerform, /* domainMigratePerform */
     NULL, /* domainMigrateFinish */
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index e30780c..0f8040b 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -11252,6 +11252,7 @@ static virDriver remote_driver = {
     remoteDomainGetSchedulerType, /* domainGetSchedulerType */
     remoteDomainGetSchedulerParameters, /* domainGetSchedulerParameters */
     remoteDomainSetSchedulerParameters, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     remoteDomainMigratePrepare, /* domainMigratePrepare */
     remoteDomainMigratePerform, /* domainMigratePerform */
     remoteDomainMigrateFinish, /* domainMigrateFinish */
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 0978214..abe4283 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -5401,6 +5401,7 @@ static virDriver testDriver = {
     testDomainGetSchedulerType, /* domainGetSchedulerType */
     testDomainGetSchedulerParams, /* domainGetSchedulerParameters */
     testDomainSetSchedulerParams, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     NULL, /* domainMigratePrepare */
     NULL, /* domainMigratePerform */
     NULL, /* domainMigrateFinish */
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 33849a0..852e066 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2207,6 +2207,7 @@ static virDriver umlDriver = {
     NULL, /* domainGetSchedulerType */
     NULL, /* domainGetSchedulerParameters */
     NULL, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     NULL, /* domainMigratePrepare */
     NULL, /* domainMigratePerform */
     NULL, /* domainMigrateFinish */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 8241d34..6ec0f1a 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -8596,6 +8596,7 @@ virDriver NAME(Driver) = {
     NULL, /* domainGetSchedulerType */
     NULL, /* domainGetSchedulerParameters */
     NULL, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     NULL, /* domainMigratePrepare */
     NULL, /* domainMigratePerform */
     NULL, /* domainMigrateFinish */
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index bbfb1a4..fc667fe 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -961,6 +961,7 @@ static virDriver vmwareDriver = {
     NULL,                       /* domainGetSchedulerType */
     NULL,                       /* domainGetSchedulerParameters */
     NULL,                       /* domainSetSchedulerParameters */
+    NULL,                       /* domainSetSchedulerParametersFlags */
     NULL,                       /* domainMigratePrepare */
     NULL,                       /* domainMigratePerform */
     NULL,                       /* domainMigrateFinish */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index dd94fbc..41b48ae 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -2162,6 +2162,7 @@ static virDriver xenUnifiedDriver = {
     xenUnifiedDomainGetSchedulerType, /* domainGetSchedulerType */
     xenUnifiedDomainGetSchedulerParameters, /* domainGetSchedulerParameters */
     xenUnifiedDomainSetSchedulerParameters, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     xenUnifiedDomainMigratePrepare, /* domainMigratePrepare */
     xenUnifiedDomainMigratePerform, /* domainMigratePerform */
     xenUnifiedDomainMigrateFinish, /* domainMigrateFinish */
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index 3fbdcc6..a57c98f 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -1843,6 +1843,7 @@ static virDriver xenapiDriver = {
     xenapiDomainGetSchedulerType, /* domainGetSchedulerType */
     NULL, /* domainGetSchedulerParameters */
     NULL, /* domainSetSchedulerParameters */
+    NULL, /* domainSetSchedulerParametersFlags */
     NULL, /* domainMigratePrepare */
     NULL, /* domainMigratePerform */
     NULL, /* domainMigrateFinish */
-- 
1.7.3.1


-- 
Thanks,
Hu Tao

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]