From 6c71a52acd081b94519dc960328098659ad84e88 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 7 Jul 2021 09:36:17 +0200 Subject: [PATCH] cpu weight: clamp to maximum for cgroup v2 In v2 the range is [1, 10000], but the API allows the old limits from 2 to 262144, so clamp the upper for v2. Signed-off-by: Thomas Lamprecht --- PVE/QemuServer.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index b890cde5..be9df1f9 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5307,6 +5307,7 @@ sub vm_start_nolock { ); if (PVE::CGroup::cgroup_mode() == 2) { + $cpuunits = 10000 if $cpuunits >= 10000; # else we get an error $properties{CPUWeight} = $cpuunits; } else { $properties{CPUShares} = $cpuunits;