all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server] api: create/update vm: fix clamping cpuunits function calls
Date: Mon, 21 Nov 2022 08:25:13 +0100	[thread overview]
Message-ID: <20221121072513.25366-1-f.ebner@proxmox.com> (raw)

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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index b0c40fa5..b8a93346 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -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);
-- 
2.30.2





             reply	other threads:[~2022-11-21  7:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-21  7:25 Fiona Ebner [this message]
2022-11-21  7:27 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221121072513.25366-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal