[pve-devel] [PATCH container 2/7] change cpu shares: hard-code cgroupv1 default parameter

Fiona Ebner f.ebner at proxmox.com
Fri Oct 7 14:41:42 CEST 2022


so that the description of the default can be changed to reflect that
it depends on cgroup version.

Not strictly necessary, because the function currently will ignore the
value anyways. But certainly more future-proof then starting to pass
something invalid.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 src/PVE/LXC/Config.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index d66cb75..48e0a6e 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1342,7 +1342,7 @@ sub vmconfig_hotplug_pending {
 	    } elsif ($opt eq 'cpulimit') {
 		$cgroup->change_cpu_quota(undef, undef); # reset, cgroup module can better decide values
 	    } elsif ($opt eq 'cpuunits') {
-		$cgroup->change_cpu_shares(undef, $confdesc->{cpuunits}->{default});
+		$cgroup->change_cpu_shares(undef, 1024);
 	    } elsif ($opt =~ m/^net(\d)$/) {
 		my $netid = $1;
 		PVE::Network::veth_delete("veth${vmid}i$netid");
@@ -1367,7 +1367,7 @@ sub vmconfig_hotplug_pending {
 		my $quota = 100000 * $value;
 		$cgroup->change_cpu_quota(int(100000 * $value), 100000);
 	    } elsif ($opt eq 'cpuunits') {
-		$cgroup->change_cpu_shares($value, $confdesc->{cpuunits}->{default});
+		$cgroup->change_cpu_shares($value, 1024);
 	    } elsif ($opt =~ m/^net(\d+)$/) {
 		my $netid = $1;
 		my $net = $class->parse_lxc_network($value);
-- 
2.30.2






More information about the pve-devel mailing list