]> xenbits.xensource.com Git - libvirt.git/commitdiff
Add global period definitions
authorAlexander Burluka <aburluka@virtuozzo.com>
Tue, 16 Feb 2016 13:43:33 +0000 (16:43 +0300)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 1 Mar 2016 14:29:06 +0000 (14:29 +0000)
This parameter represents top level period cgroup
that limits whole domain enforcement period for a quota

Signed-off-by: Alexander Burluka <aburluka@virtuozzo.com>
docs/schemas/domaincommon.rng
include/libvirt/libvirt-domain.h
src/conf/domain_conf.c
src/conf/domain_conf.h

index 4e5739473751248be0b37517ff7b161114b6ee20..e21ce85df09c46ca9ad86c170a0c46f2c5a0e16c 100644 (file)
             <ref name="cpushares"/>
           </element>
         </optional>
+        <optional>
+          <element name="global_period">
+            <ref name="cpuperiod"/>
+          </element>
+        </optional>
         <optional>
           <element name="period">
             <ref name="cpuperiod"/>
index 65f1618af38731c14ebf5b428c04c31c5cb4da3d..3ec982ceeaa46744ef6a85aeb420e81f50b31ea1 100644 (file)
@@ -311,6 +311,14 @@ typedef enum {
  */
 # define VIR_DOMAIN_SCHEDULER_CPU_SHARES "cpu_shares"
 
+/**
+ * VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD:
+ *
+ * Macro represents the enforcement period for a quota, in microseconds,
+ * for whole domain, when using the posix scheduler, as a ullong.
+ */
+# define VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD "global_period"
+
 /**
  * VIR_DOMAIN_SCHEDULER_VCPU_PERIOD:
  *
@@ -3338,6 +3346,14 @@ typedef void (*virConnectDomainEventMigrationIterationCallback)(virConnectPtr co
  */
 # define VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES "cputune.cpu_shares"
 
+/**
+ * VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD:
+ *
+ * Macro represents the enforcement period for a quota, in microseconds,
+ * for whole domain, when using the posix scheduler, as VIR_TYPED_PARAM_ULLONG.
+ */
+# define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD "cputune.global_period"
+
 /**
  * VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD:
  *
index 7d7594e89f1e208d8f7c36de4b18f22bbeb5ea74..6872b5044454bc959428845faeb35520e790b6a0 100644 (file)
@@ -15140,6 +15140,21 @@ virDomainDefParseXML(xmlDocPtr xml,
         goto error;
     }
 
+    if (virXPathULongLong("string(./cputune/global_period[1])", ctxt,
+                          &def->cputune.global_period) < -1) {
+        virReportError(VIR_ERR_XML_ERROR, "%s",
+                       _("can't parse cputune global period value"));
+        goto error;
+    }
+
+    if (def->cputune.global_period > 0 &&
+        (def->cputune.global_period < 1000 || def->cputune.global_period > 1000000)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("Value of cputune global period must be in range "
+                         "[1000, 1000000]"));
+        goto error;
+    }
+
     if (virXPathULongLong("string(./cputune/emulator_period[1])", ctxt,
                           &def->cputune.emulator_period) < -1) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -21655,6 +21670,9 @@ virDomainCputuneDefFormat(virBufferPtr buf,
     if (def->cputune.quota)
         virBufferAsprintf(&childrenBuf, "<quota>%lld</quota>\n",
                           def->cputune.quota);
+    if (def->cputune.global_period)
+        virBufferAsprintf(&childrenBuf, "<global_period>%llu</global_period>\n",
+                          def->cputune.global_period);
 
     if (def->cputune.emulator_period)
         virBufferAsprintf(&childrenBuf, "<emulator_period>%llu"
index 7e437fa90f4885705bfbd3c5fda142c85b3864fc..9af1a7c07f9a3ba607fa4836d9449938d1a743ff 100644 (file)
@@ -2112,6 +2112,7 @@ struct _virDomainCputune {
     bool sharesSpecified;
     unsigned long long period;
     long long quota;
+    unsigned long long global_period;
     unsigned long long emulator_period;
     long long emulator_quota;
     virBitmapPtr emulatorpin;