]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/QemuServer.pm
implement cgroups through systemd-run
[qemu-server.git] / PVE / QemuServer.pm
index 22ff875b6322796efa8f72c7b87df24dbb5e8353..3cd44751b9f0ca1e3ac4bd7fa4aab73fa9a9716a 100644 (file)
@@ -2618,6 +2618,15 @@ sub config_to_command {
     my $hotplug_features = parse_hotplug_features(defined($conf->{hotplug}) ? $conf->{hotplug} : '1');
     my $machine_type = $forcemachine || $conf->{machine};
 
+    my $cpuunits = defined($conf->{cpuunits}) ?
+            $conf->{cpuunits} : $defaults->{cpuunits};
+
+    push @$cmd, '/usr/bin/systemd-run';
+    push @$cmd, '--scope';
+    push @$cmd, '--slice', "qemu";
+    push @$cmd, '--unit', $vmid;
+    push @$cmd, '-p', "CPUShares=$cpuunits";
+
     push @$cmd, '/usr/bin/kvm';
 
     push @$cmd, '-id', $vmid;