[pve-devel] applied: [PATCH manager] api: ceph: pools: get_storages: set pool name if missing

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Oct 14 15:45:38 CEST 2022


Am 13/10/2022 um 12:32 schrieb Aaron Lauterer:
> This avoids errors about the use of uninitialized values if the 'pool'
> parameter is not present in the storage configuration.
> 
> The 'pool' property for an RBD storage config is not mandatory.
> 
> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
> ---
>  PVE/API2/Ceph/Pools.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
> index 544d56dc..6c05250e 100644
> --- a/PVE/API2/Ceph/Pools.pm
> +++ b/PVE/API2/Ceph/Pools.pm
> @@ -321,6 +321,7 @@ my $get_storages = sub {
>      foreach my $storeid (keys %$storages) {
>  	my $curr = $storages->{$storeid};
>  	next if $curr->{type} ne 'rbd';
> +	$curr->{pool} = 'rbd' if !defined $curr->{pool}; # set default

fwiw, the following slightly shorter would work too, but it really doesn't
matter so I kept it as is.

$curr->{pool} //= 'rbd'; # set default

applied, thanks





More information about the pve-devel mailing list