[pve-devel] [PATCH v2 container 5/7] hotplug: handle pool limits

Daniel Kral d.kral at proxmox.com
Thu Dec 19 17:03:34 CET 2024


On 16/04/2024 14:20, Fabian Grünbichler wrote:
> 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 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},
> +	    })

This seems to run fine, but shouldn't there be a semicolon?

> +	}
>  	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









More information about the pve-devel mailing list