libvirt/libvirt-vircgroupv2-fix-cpu.weight-limits-check.patch
Jiri Denemark 86af401d07 libvirt-9.0.0-2.el9
- vircgroupv2: fix cpu.weight limits check (rhbz#2037998)
- domain_validate: drop cpu.shares cgroup check (rhbz#2037998)
- docs: document correct cpu shares limits with both cgroups v1 and v2 (rhbz#2037998)
- qemu_interface: Fix managed='no' case when creating an ethernet interface (rhbz#2144738)
- conf: clarify some external TPM error messages (rhbz#2063723)
- qemu: hotplug: Remove legacy quirk for 'dimm' address generation (rhbz#2158701)
- qemu: alias: Remove 'oldAlias' argument of qemuAssignDeviceMemoryAlias (rhbz#2158701)
- qemu: Remove 'memAliasOrderMismatch' field from VM private data (rhbz#2158701)
- rpc: Fix error message in virNetServerSetClientLimits (rhbz#2033879)

Resolves: rhbz#2033879, rhbz#2037998, rhbz#2063723, rhbz#2144738, rhbz#2158701
2023-01-25 10:13:33 +01:00

60 lines
2.2 KiB
Diff

From 28bd414db666463dca0a26bbb969fd6bc784ec8e Mon Sep 17 00:00:00 2001
Message-Id: <28bd414db666463dca0a26bbb969fd6bc784ec8e@dist-git>
From: Pavel Hrdina <phrdina@redhat.com>
Date: Tue, 17 Jan 2023 10:02:07 +0100
Subject: [PATCH] vircgroupv2: fix cpu.weight limits check
The cgroup v2 cpu.weight limits are different than cgroup v1 cpu.shares
limits.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit cf3414a85b8383d71d6ae2a53daf63c331cc2230)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2037998
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
src/util/vircgroup.h | 2 ++
src/util/vircgroupv2.c | 8 ++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/util/vircgroup.h b/src/util/vircgroup.h
index 690f09465c..adf3850b22 100644
--- a/src/util/vircgroup.h
+++ b/src/util/vircgroup.h
@@ -235,6 +235,8 @@ int virCgroupGetCpuShares(virCgroup *group, unsigned long long *shares);
/* Based on kernel code ((1ULL << MAX_BW_BITS) - 1) where MAX_BW_BITS is
* (64 - BW_SHIFT) and BW_SHIFT is 20 */
#define VIR_CGROUP_CPU_QUOTA_MAX 17592186044415LL
+#define VIR_CGROUPV2_WEIGHT_MIN 1LL
+#define VIR_CGROUPV2_WEIGHT_MAX 10000LL
int virCgroupSetCpuCfsPeriod(virCgroup *group, unsigned long long cfs_period);
int virCgroupGetCpuCfsPeriod(virCgroup *group, unsigned long long *cfs_period);
diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c
index b1f562aa52..219b9c7f21 100644
--- a/src/util/vircgroupv2.c
+++ b/src/util/vircgroupv2.c
@@ -1499,13 +1499,13 @@ static int
virCgroupV2SetCpuShares(virCgroup *group,
unsigned long long shares)
{
- if (shares < VIR_CGROUP_CPU_SHARES_MIN ||
- shares > VIR_CGROUP_CPU_SHARES_MAX) {
+ if (shares < VIR_CGROUPV2_WEIGHT_MIN ||
+ shares > VIR_CGROUPV2_WEIGHT_MAX) {
virReportError(VIR_ERR_INVALID_ARG,
_("shares '%llu' must be in range [%llu, %llu]"),
shares,
- VIR_CGROUP_CPU_SHARES_MIN,
- VIR_CGROUP_CPU_SHARES_MAX);
+ VIR_CGROUPV2_WEIGHT_MIN,
+ VIR_CGROUPV2_WEIGHT_MAX);
return -1;
}
--
2.39.1