diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e21ce85df09c46ca9ad86c170a0c46f2c5a0e16c..6ca937c07a3935fe2185c85e09c7fa757c846695 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -674,6 +674,11 @@ + + + + + diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 3ec982ceeaa46744ef6a85aeb420e81f50b31ea1..79c25df9e59df39d6539513518c01169bc228db3 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -319,6 +319,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: * @@ -3354,6 +3362,14 @@ typedef void (*virConnectDomainEventMigrationIterationCallback)(virConnectPtr co */ # 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: * diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6872b5044454bc959428845faeb35520e790b6a0..39451edf4135e29ef149236c880cb9894a3728a5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15155,6 +15155,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", @@ -21673,6 +21689,9 @@ virDomainCputuneDefFormat(virBufferPtr buf, if (def->cputune.global_period) virBufferAsprintf(&childrenBuf, "%llu\n", def->cputune.global_period); + if (def->cputune.global_quota) + virBufferAsprintf(&childrenBuf, "%lld\n", + def->cputune.global_quota); if (def->cputune.emulator_period) virBufferAsprintf(&childrenBuf, "%llu" diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9af1a7c07f9a3ba607fa4836d9449938d1a743ff..06305f0383b56a43e9df900e31cfa131436e4270 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2113,6 +2113,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; virBitmapPtr emulatorpin;