[pve-devel] [PATCH 1/3] implement cgroups through systemd-run

Alexandre Derumier aderumier at odiso.com
Thu May 28 15:59:21 CEST 2015


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 22ff875..3cd4475 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -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;
-- 
2.1.4




More information about the pve-devel mailing list