From 6cbd3eb82cc924a3da8bc3c98aabf925367647ee Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Fri, 30 Oct 2020 10:42:36 +0100 Subject: [PATCH] systemd scope: add CPUWeight for cgroupv2 --- PVE/QemuServer.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 4a96dca..9704042 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -5078,10 +5078,15 @@ sub vm_start_nolock { my %properties = ( Slice => 'qemu.slice', - KillMode => 'none', - CPUShares => $cpuunits + KillMode => 'none' ); + if (PVE::CGroup::cgroup_mode() == 2) { + $properties{CPUWeight} = $cpuunits; + } else { + $properties{CPUShares} = $cpuunits; + } + if (my $cpulimit = $conf->{cpulimit}) { $properties{CPUQuota} = int($cpulimit * 100); } -- 2.39.2