[pve-devel] [PATCH container] correctly set unlimited cpulimit at runtime

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Sep 15 14:51:57 CEST 2016


'-1' means no limit for this cgroup value, so use this like we already do when
deleting the cpulimit.
---
 src/PVE/LXC/Config.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 7480fff..2ec643e 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -883,7 +883,11 @@ sub update_pct_config {
 	    my $list = PVE::LXC::verify_searchdomain_list($value);
 	    $conf->{$opt} = $list;
 	} elsif ($opt eq 'cpulimit') {
-	    PVE::LXC::write_cgroup_value("cpu", $vmid, "cpu.cfs_quota_us", int(100000*$value));
+	    if ($value == 0) {
+		PVE::LXC::write_cgroup_value("cpu", $vmid, "cpu.cfs_quota_us", -1);
+	    } else {
+		PVE::LXC::write_cgroup_value("cpu", $vmid, "cpu.cfs_quota_us", int(100000*$value));
+	    }
 	    $conf->{$opt} = $value;
 	} elsif ($opt eq 'cpuunits') {
 	    $conf->{$opt} = $value;
-- 
2.1.4





More information about the pve-devel mailing list