Am 07/10/2022 um 14:41 schrieb Fiona Ebner: > while making it take the value directly instead of the config. > > Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> > --- > src/PVE/GuestHelpers.pm | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/src/PVE/GuestHelpers.pm b/src/PVE/GuestHelpers.pm > index 0fe3fd6..f3a4202 100644 > --- a/src/PVE/GuestHelpers.pm > +++ b/src/PVE/GuestHelpers.pm > @@ -3,6 +3,7 @@ package PVE::GuestHelpers; > use strict; > use warnings; > > +use PVE::CGroup; > use PVE::Tools; > use PVE::Storage; > > @@ -246,4 +247,19 @@ sub config_with_pending_array { > return $res; > } > > +sub get_cpuunits { > + my ($cpuunits) = @_; > + > + my $is_cgroupv2 = PVE::CGroup::cgroup_mode() == 2; > + > + return $is_cgroupv2 ? 100 : 1024 if !defined($cpuunits); > + > + if ($is_cgroupv2) { > + $cpuunits = 10000 if $cpuunits >= 10000; # v1 can be higher, so clamp > v2 there > + } else { > + $cpuunits = 2 if $cpuunits < 2; # v2 can be lower, so clamp v1 there > + } > + return $cpuunits; > +} > + > 1;
replaced with adding a similar clamp_cpu_shares method to pve-common's PVE::CGroup module _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel