mirror of
https://git.proxmox.com/git/qemu-server
synced 2026-01-26 22:13:41 +00:00
api: create/update vm: clamp cpuunit value
While the clamping already happens before setting the actual systemd
CPU{Shares, Weight}, 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 upon parsing the config.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
0d31845364
commit
dbc45fdf9f
@ -814,6 +814,9 @@ __PACKAGE__->register_method({
|
||||
PVE::Tools::validate_ssh_public_keys($ssh_keys);
|
||||
}
|
||||
|
||||
$param->{cpuunits} = PVE::GuestHelpers::get_cpuunits($param->{cpuunits})
|
||||
if defined($param->{cpuunits}); # clamp value depending on cgroup version
|
||||
|
||||
PVE::Cluster::check_cfs_quorum();
|
||||
|
||||
my $filename = PVE::QemuConfig->config_file($vmid);
|
||||
@ -1362,6 +1365,9 @@ my $update_vm_api = sub {
|
||||
PVE::Tools::validate_ssh_public_keys($ssh_keys);
|
||||
}
|
||||
|
||||
$param->{cpuunits} = PVE::GuestHelpers::get_cpuunits($param->{cpuunits})
|
||||
if defined($param->{cpuunits}); # clamp value depending on cgroup version
|
||||
|
||||
die "no options specified\n" if !$delete_str && !$revert_str && !scalar(keys %$param);
|
||||
|
||||
my $storecfg = PVE::Storage::config();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user