rbd: warn if no stats for a pool could be gathered

happens in case of a mistyped poolname, and the new message should be
more helpful than:
`Use of uninitialized value $free in addition (+) at \
/usr/share/perl5/PVE/Storage/RBDPlugin.pm line 64`

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
Stoiko Ivanov
2022-05-03 13:31:40 +02:00
committed by Thomas Lamprecht
parent 0c317c6c0f
commit ae93163343

View File

@ -634,6 +634,11 @@ sub status {
my ($d) = grep { $_->{name} eq $pool } @{$df->{pools}};
if (!defined($d)) {
warn "could not get usage stats for pool '$pool'\n";
return;
}
# max_avail -> max available space for data w/o replication in the pool
# bytes_used -> data w/o replication in the pool
my $free = $d->{stats}->{max_avail};