]> git.proxmox.com Git - pve-storage.git/commitdiff
rbd: add fallback default poolname 'rbd' to status
authorStoiko Ivanov <s.ivanov@proxmox.com>
Tue, 3 May 2022 11:31:39 +0000 (13:31 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 13 May 2022 12:08:13 +0000 (14:08 +0200)
the fallback to a default pool name of 'rbd' was introduced in:
1440604a4b072b88cc1e4f8bbae4511b50d1d68e
and worked for the status command, because it used the `rados_cmd`
sub.

This fallback was lost with the changes in:
41aacc6cdeea9b0c8007cbfb280acf827932c3d6

leading to confusing errors:
`Use of uninitialized value in string eq at \
/usr/share/perl5/PVE/Storage/RBDPlugin.pm line 633`
(e.g. in the journal from pvestatd)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PVE/Storage/RBDPlugin.pm

index 22cac222dbd0f5edfa369c3b30ae4392cee623b2..9ee6a3759357bf1eab43deb668a5c69b4f328b5b 100644 (file)
@@ -630,7 +630,9 @@ sub status {
     my $rados = $librados_connect->($scfg, $storeid);
     my $df = $rados->mon_command({ prefix => 'df', format => 'json' });
 
-    my ($d) = grep { $_->{name} eq $scfg->{pool} } @{$df->{pools}};
+    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
+
+    my ($d) = grep { $_->{name} eq $pool } @{$df->{pools}};
 
     # max_avail -> max available space for data w/o replication in the pool
     # bytes_used -> data w/o replication in the pool