if the start is not part of an incoming migration, check the VM against its
pool's run limit.

Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>
---
 PVE/QemuServer.pm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index be937ec1..78b6ff96 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5704,6 +5704,19 @@ sub vm_start_nolock {
            # But we do it above, so for now let's be consistent.
            $conf = PVE::QemuConfig->load_config($vmid); # update/reload
        }
+
+       my $cpu_count = 1;
+       $cpu_count = $conf->{sockets} if $conf->{sockets};
+       $cpu_count *= ($conf->{cores} || 1);
+       $cpu_count = $conf->{vcpus} if $conf->{vcpus} && $conf->{vcpus} < 
$cpu_count;
+
+       my $changes = {
+           absolute => 1,
+           running => 1,
+           mem => get_current_memory($conf->{memory}),
+           cpu => $cpu_count,
+       };
+       PVE::GuestHelpers::check_guest_pool_limit($vmid, $changes);
     }
 
     # override offline migrated volumes, conf is out of date still
-- 
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