]> git.proxmox.com Git - qemu-server.git/commitdiff
api: create/update vm: fix clamping cpuunits function calls
authorFiona Ebner <f.ebner@proxmox.com>
Mon, 21 Nov 2022 07:25:13 +0000 (08:25 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 21 Nov 2022 07:27:03 +0000 (08:27 +0100)
When applying the series introducing those calls, the helper was moved
to pve-common's CGroup.pm (see 07c10d5 ("cgroup: move get_cpuunits
helper from qemu-server as clamp_cpu_shares") in pve-common) instead
of pve-guest-common's GuestHelpers.pm. But these calls were not
updated.

Reported in the community forum:
https://forum.proxmox.com/threads/118267

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/API2/Qemu.pm

index 98ac63f7fb6630d66d8899e89d9a7b4dbc5ee67f..6bdcce216164c2050fcbf2c7fbb5940b0357f26b 100644 (file)
@@ -13,6 +13,7 @@ use Crypt::OpenSSL::Random;
 use Socket qw(SOCK_STREAM);
 
 use PVE::APIClient::LWP;
+use PVE::CGroup;
 use PVE::Cluster qw (cfs_read_file cfs_write_file);;
 use PVE::RRD;
 use PVE::SafeSyslog;
@@ -818,7 +819,7 @@ __PACKAGE__->register_method({
                PVE::Tools::validate_ssh_public_keys($ssh_keys);
        }
 
-       $param->{cpuunits} = PVE::GuestHelpers::get_cpuunits($param->{cpuunits})
+       $param->{cpuunits} = PVE::CGroup::clamp_cpu_shares($param->{cpuunits})
            if defined($param->{cpuunits}); # clamp value depending on cgroup version
 
        PVE::Cluster::check_cfs_quorum();
@@ -1481,7 +1482,7 @@ my $update_vm_api  = sub {
        PVE::Tools::validate_ssh_public_keys($ssh_keys);
     }
 
-    $param->{cpuunits} = PVE::GuestHelpers::get_cpuunits($param->{cpuunits})
+    $param->{cpuunits} = PVE::CGroup::clamp_cpu_shares($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);