While the clamping already happens before setting the actual
cpu.weight lxc config key, it can be done here too, to avoid writing
new out-of-range values into the config.
Can't use a validator enforcing this, because existing out-of-range
values should not become errors on parsing the config.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
my $restore = extract_param($param, 'restore');
my $unique = extract_param($param, 'unique');
+ $param->{cpuunits} = PVE::CGroup::clamp_cpu_shares($param->{cpuunits})
+ if defined($param->{cpuunits}); # clamp value depending on cgroup version
+
# used to skip firewall config restore if user lacks permission
my $skip_fw_config_restore = 0;
use PVE::Cluster qw(cfs_read_file);
use PVE::AccessControl;
use PVE::Firewall;
+use PVE::GuestHelpers;
use PVE::Storage;
use PVE::RESTHandler;
use PVE::RPCEnvironment;
my $revert_str = extract_param($param, 'revert');
my @revert = PVE::Tools::split_list($revert_str);
+ $param->{cpuunits} = PVE::CGroup::clamp_cpu_shares($param->{cpuunits})
+ if defined($param->{cpuunits}); # clamp value depending on cgroup version
+
my $code = sub {
my $conf = PVE::LXC::Config->load_config($vmid);