5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-08 21:18:03 +03:00

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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-07-07 09:36:17 +02:00
parent 4a5cb613d3
commit 6c71a52acd

View File

@ -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;