From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 2/2] rbd: warn if no stats for a pool could be gathered
Date: Tue, 3 May 2022 13:31:40 +0200 [thread overview]
Message-ID: <20220503113140.1680807-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20220503113140.1680807-1-s.ivanov@proxmox.com>
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>
---
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
prev parent reply other threads:[~2022-05-03 11:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-03 11:31 [pve-devel] [PATCH storage 0/2] rbd: improve errormessages on missing/wrong poolname Stoiko Ivanov
2022-05-03 11:31 ` [pve-devel] [PATCH storage 1/2] rbd: add fallback default poolname 'rbd' to status Stoiko Ivanov
2022-05-03 11:31 ` Stoiko Ivanov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220503113140.1680807-3-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox