On 16/04/2024 14:20, Fabian Grünbichler wrote: > 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 > --- > 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}), Bug: The memory value here should be converted from MiB to bytes, else the pool limit will not be enforced as `check_guest_pool_limit` expects the value to be in bytes, i.e. `get_current_memory(...) * 1024 * 1024`. Spotted it by starting a second VM (which would've raised the memory usage over the limit) and wondered why it didn't fail. For the third VM I got: ``` pool limits exhausted: (run) mem: 4096 + 0.001953125 over 3072 ``` > + cpu => $cpu_count, > + }; > + PVE::GuestHelpers::check_guest_pool_limit($vmid, $changes); > } > > # override offline migrated volumes, conf is out of date still > -- > 2.39.2