[pve-devel] [PATCH qemu-server 3/3] systemd scope: add CPUWeight for cgroupv2

Alexandre Derumier aderumier at odiso.com
Fri Oct 30 10:42:36 CET 2020


---
 PVE/QemuServer.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1fd6338..af74d64 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5064,10 +5064,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.20.1





More information about the pve-devel mailing list