This parameter controls the maximum bandwidth to be used
within a period for whole domain.
Signed-off-by: Alexander Burluka <aburluka(a)virtuozzo.com>
---
docs/schemas/domaincommon.rng | 5 +++++
include/libvirt/libvirt-domain.h | 16 ++++++++++++++++
src/conf/domain_conf.c | 19 +++++++++++++++++++
src/conf/domain_conf.h | 1 +
4 files changed, 41 insertions(+)
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index aa7eae9..17653e1 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -675,6 +675,11 @@
</element>
</optional>
<optional>
+ <element name="global_quota">
+ <ref name="cpuquota"/>
+ </element>
+ </optional>
+ <optional>
<element name="period">
<ref name="cpuperiod"/>
</element>
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index cb30313..7d3d8e8 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -320,6 +320,14 @@ typedef enum {
# define VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD "global_period"
/**
+ * VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA:
+ *
+ * Macro represents the maximum bandwidth to be used within a period for
+ * whole domain, when using the posix scheduler, as an llong.
+ */
+# define VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA "global_quota"
+
+/**
* VIR_DOMAIN_SCHEDULER_VCPU_PERIOD:
*
* Macro represents the enforcement period for a quota, in microseconds,
@@ -3334,6 +3342,14 @@ typedef void
(*virConnectDomainEventDeviceAddedCallback)(virConnectPtr conn,
# define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD "cputune.global_period"
/**
+ * VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA:
+ *
+ * Macro represents the maximum bandwidth to be used within a period for
+ * whole domain, when using the posix scheduler, as VIR_TYPED_PARAM_LLONG.
+ */
+# define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA "cputune.global_quota"
+
+/**
* VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD:
*
* Macro represents the enforcement period for a quota, in microseconds,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5ee53c2..7e7a69c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15074,6 +15074,22 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
}
+ if (virXPathLongLong("string(./cputune/global_quota[1])", ctxt,
+ &def->cputune.global_quota) < -1) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("can't parse cputune global quota value"));
+ goto error;
+ }
+
+ if (def->cputune.global_quota > 0 &&
+ (def->cputune.global_quota < 1000 ||
+ def->cputune.global_quota > 18446744073709551LL)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Value of cputune global quota must be in range "
+ "[1000, 18446744073709551]"));
+ goto error;
+ }
+
if (virXPathULongLong("string(./cputune/emulator_period[1])", ctxt,
&def->cputune.emulator_period) < -1) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -21836,6 +21852,9 @@ virDomainDefFormatInternal(virDomainDefPtr def,
if (def->cputune.global_period)
virBufferAsprintf(&childrenBuf,
"<global_period>%llu</global_period>\n",
def->cputune.global_period);
+ if (def->cputune.global_quota)
+ virBufferAsprintf(&childrenBuf,
"<global_quota>%lld</global_quota>\n",
+ def->cputune.global_quota);
if (def->cputune.emulator_period)
virBufferAsprintf(&childrenBuf, "<emulator_period>%llu"
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7c43e7d..bac82b3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2136,6 +2136,7 @@ struct _virDomainCputune {
unsigned long long period;
long long quota;
unsigned long long global_period;
+ long long global_quota;
unsigned long long emulator_period;
long long emulator_quota;
size_t nvcpupin;
--
1.8.3.1