|
|
397dc2 |
From 499e3eb6bdca10a5fac9279261e32e64c28273bd Mon Sep 17 00:00:00 2001
|
|
|
397dc2 |
Message-Id: <499e3eb6bdca10a5fac9279261e32e64c28273bd@dist-git>
|
|
|
397dc2 |
From: Pavel Hrdina <phrdina@redhat.com>
|
|
|
397dc2 |
Date: Thu, 4 Mar 2021 12:57:55 +0100
|
|
|
397dc2 |
Subject: [PATCH] domain_validate: use defines for cpu period and quota limits
|
|
|
397dc2 |
MIME-Version: 1.0
|
|
|
397dc2 |
Content-Type: text/plain; charset=UTF-8
|
|
|
397dc2 |
Content-Transfer-Encoding: 8bit
|
|
|
397dc2 |
|
|
|
397dc2 |
Commints <bc760f4d7c4f964fadcb2a73e126b0053e7a9b06> and
|
|
|
397dc2 |
<98a09ca48ed4fc011abf2aa290e02ce1b8f1bb5f> fixed the code to use
|
|
|
397dc2 |
defines instead of magic numbers but missed this place.
|
|
|
397dc2 |
|
|
|
397dc2 |
Following commit <ed1ba69f5a8132f8c1e73d2a1f142d70de0b564a> changed
|
|
|
397dc2 |
the cpu quota limit to reflect what kernel actually allows so using
|
|
|
397dc2 |
the defines fixes XML validations as well.
|
|
|
397dc2 |
|
|
|
397dc2 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
397dc2 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
397dc2 |
(cherry picked from commit 22cae2ea4bad7e285ba19d536bd475f8b00841f8)
|
|
|
397dc2 |
|
|
|
397dc2 |
Conflicts:
|
|
|
397dc2 |
src/conf/domain_validate.c
|
|
|
397dc2 |
- not present in downstream, the code is still part of
|
|
|
397dc2 |
domain_conf.c
|
|
|
397dc2 |
|
|
|
397dc2 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1798463
|
|
|
397dc2 |
|
|
|
397dc2 |
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
|
|
|
397dc2 |
Message-Id: <63a44700876e2bd59f276fcd8395abaff011b4c1.1614858616.git.phrdina@redhat.com>
|
|
|
397dc2 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
397dc2 |
---
|
|
|
397dc2 |
src/conf/domain_conf.c | 20 +++++++++++++-------
|
|
|
397dc2 |
1 file changed, 13 insertions(+), 7 deletions(-)
|
|
|
397dc2 |
|
|
|
397dc2 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
397dc2 |
index 166c3e48d2..9f6cdb0de8 100644
|
|
|
397dc2 |
--- a/src/conf/domain_conf.c
|
|
|
397dc2 |
+++ b/src/conf/domain_conf.c
|
|
|
397dc2 |
@@ -34,6 +34,7 @@
|
|
|
397dc2 |
#include "domain_addr.h"
|
|
|
397dc2 |
#include "domain_conf.h"
|
|
|
397dc2 |
#include "snapshot_conf.h"
|
|
|
397dc2 |
+#include "vircgroup.h"
|
|
|
397dc2 |
#include "viralloc.h"
|
|
|
397dc2 |
#include "virxml.h"
|
|
|
397dc2 |
#include "viruuid.h"
|
|
|
397dc2 |
@@ -6997,10 +6998,13 @@ virDomainDefLifecycleActionValidate(const virDomainDef *def)
|
|
|
397dc2 |
#define CPUTUNE_VALIDATE_PERIOD(name) \
|
|
|
397dc2 |
do { \
|
|
|
397dc2 |
if (def->cputune.name > 0 && \
|
|
|
397dc2 |
- (def->cputune.name < 1000 || def->cputune.name > 1000000)) { \
|
|
|
397dc2 |
+ (def->cputune.name < VIR_CGROUP_CPU_PERIOD_MIN || \
|
|
|
397dc2 |
+ def->cputune.name > VIR_CGROUP_CPU_PERIOD_MAX)) { \
|
|
|
397dc2 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
|
|
397dc2 |
- _("Value of cputune '%s' must be in range " \
|
|
|
397dc2 |
- "[1000, 1000000]"), #name); \
|
|
|
397dc2 |
+ _("Value of cputune '%s' must be in range [%llu, %llu]"), \
|
|
|
397dc2 |
+ #name, \
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_PERIOD_MIN, \
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_PERIOD_MAX); \
|
|
|
397dc2 |
return -1; \
|
|
|
397dc2 |
} \
|
|
|
397dc2 |
} while (0)
|
|
|
397dc2 |
@@ -7008,11 +7012,13 @@ virDomainDefLifecycleActionValidate(const virDomainDef *def)
|
|
|
397dc2 |
#define CPUTUNE_VALIDATE_QUOTA(name) \
|
|
|
397dc2 |
do { \
|
|
|
397dc2 |
if (def->cputune.name > 0 && \
|
|
|
397dc2 |
- (def->cputune.name < 1000 || \
|
|
|
397dc2 |
- def->cputune.name > 18446744073709551LL)) { \
|
|
|
397dc2 |
+ (def->cputune.name < VIR_CGROUP_CPU_QUOTA_MIN || \
|
|
|
397dc2 |
+ def->cputune.name > VIR_CGROUP_CPU_QUOTA_MAX)) { \
|
|
|
397dc2 |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
|
|
397dc2 |
- _("Value of cputune '%s' must be in range " \
|
|
|
397dc2 |
- "[1000, 18446744073709551]"), #name); \
|
|
|
397dc2 |
+ _("Value of cputune '%s' must be in range [%llu, %llu]"), \
|
|
|
397dc2 |
+ #name, \
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_QUOTA_MIN, \
|
|
|
397dc2 |
+ VIR_CGROUP_CPU_QUOTA_MAX); \
|
|
|
397dc2 |
return -1; \
|
|
|
397dc2 |
} \
|
|
|
397dc2 |
} while (0)
|
|
|
397dc2 |
--
|
|
|
397dc2 |
2.30.0
|
|
|
397dc2 |
|