[pve-devel] [PATCH storage 2/2] rbd: warn if no stats for a pool could be gathered
Stoiko Ivanov
s.ivanov at proxmox.com
Tue May 3 13:31:40 CEST 2022
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 at proxmox.com>
---
PVE/Storage/RBDPlugin.pm | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index c4a69b2..702fe6d 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -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};
--
2.30.2
More information about the pve-devel
mailing list