]> git.proxmox.com Git - qemu-server.git/commitdiff
implement cgroups through systemd-run
authorAlexandre Derumier <aderumier@odiso.com>
Thu, 28 May 2015 13:59:21 +0000 (15:59 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 29 May 2015 06:11:02 +0000 (08:11 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
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;