[pve-devel] [PATCH container 5/7] hotplug: handle pool limits
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Apr 10 15:13:03 CEST 2024
by checking the new values against the running limits.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
src/PVE/LXC/Config.pm | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 908d64a..787bcf2 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1425,6 +1425,13 @@ sub vmconfig_hotplug_pending {
foreach my $opt (sort keys %{$conf->{pending}}) { # add/change
next if $selection && !$selection->{$opt};
+ if ($opt eq 'cores') {
+ PVE::GuestHelpers::check_guest_pool_limit($vmid, {
+ running => 1,
+ absolute => 1,
+ cpu => $conf->{pending}->{cores},
+ })
+ }
if ($LXC_FASTPLUG_OPTIONS->{$opt}) {
$conf->{$opt} = delete $conf->{pending}->{$opt};
}
@@ -1438,6 +1445,12 @@ sub vmconfig_hotplug_pending {
my $hotplug_memory = sub {
my ($new_memory, $new_swap) = @_;
+ PVE::GuestHelpers::check_guest_pool_limit($vmid, {
+ running => 1,
+ absolute => 1,
+ mem => ($new_memory + $new_swap)*1024*1024,
+ });
+
($new_memory, my $new_memory_high) = calculate_memory_constraints($new_memory);
$new_swap = int($new_swap * 1024 * 1024) if defined($new_swap);
$cgroup->change_memory_limit($new_memory, $new_swap, $new_memory_high);
--
2.39.2
More information about the pve-devel
mailing list