public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] api: ceph: pools: get_storages: set pool name if missing
@ 2022-10-13 10:32 Aaron Lauterer
  2022-10-14 13:45 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron Lauterer @ 2022-10-13 10:32 UTC (permalink / raw)
  To: pve-devel

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@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH manager] api: ceph: pools: get_storages: set pool name if missing
  2022-10-13 10:32 [pve-devel] [PATCH manager] api: ceph: pools: get_storages: set pool name if missing Aaron Lauterer
@ 2022-10-14 13:45 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-10-14 13:45 UTC (permalink / raw)
  To: Proxmox VE development discussion, Aaron Lauterer

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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-10-14 13:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-13 10:32 [pve-devel] [PATCH manager] api: ceph: pools: get_storages: set pool name if missing Aaron Lauterer
2022-10-14 13:45 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal