* [pve-devel] [PATCH storage 0/2] rbd: improve errormessages on missing/wrong poolname
@ 2022-05-03 11:31 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 ` [pve-devel] [PATCH storage 2/2] rbd: warn if no stats for a pool could be gathered Stoiko Ivanov
0 siblings, 2 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2022-05-03 11:31 UTC (permalink / raw)
To: pve-devel
ran into the issues while configuring an external rbd-storage on my node (and
not adding the correct poolname)
Issue is cosmetic in nature - but the new messages should help in identifying
where the problem is rooted
Stoiko Ivanov (2):
rbd: add fallback default poolname 'rbd' to status
rbd: warn if no stats for a pool could be gathered
PVE/Storage/RBDPlugin.pm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH storage 1/2] rbd: add fallback default poolname 'rbd' to status
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 ` Stoiko Ivanov
2022-05-03 11:31 ` [pve-devel] [PATCH storage 2/2] rbd: warn if no stats for a pool could be gathered Stoiko Ivanov
1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2022-05-03 11:31 UTC (permalink / raw)
To: pve-devel
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 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 91a4a76..c4a69b2 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -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
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH storage 2/2] rbd: warn if no stats for a pool could be gathered
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
1 sibling, 0 replies; 3+ messages in thread
From: Stoiko Ivanov @ 2022-05-03 11:31 UTC (permalink / raw)
To: pve-devel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-03 11:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pve-devel] [PATCH storage 2/2] rbd: warn if no stats for a pool could be gathered Stoiko Ivanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox