by checking the new values against the running limits.

Signed-off-by: Fabian Grünbichler <f.gruenbich...@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 a6baccd..248100e 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -1434,6 +1434,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};
        }
@@ -1447,6 +1454,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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to