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

Aaron Lauterer a.lauterer at proxmox.com
Thu Oct 13 12:32:47 CEST 2022


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
 	if (
 	    $pool eq $curr->{pool} ||
 	    (defined $curr->{'data-pool'} && $pool eq $curr->{'data-pool'})
-- 
2.30.2






More information about the pve-devel mailing list