[pve-devel] [PATCH manager v3 1/2] api: ceph: add applications of each pool to the lspools endpoint
Stefan Sterz
s.sterz at proxmox.com
Thu Oct 20 09:17:03 CEST 2022
since ceph luminous (ceph 12) pools need to be associated with at
least one applicaton. expose this information here too so that clients
of this endpoint can use it
Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
v3: add an api viewer entry for the applications object
thanks @ alwin antreich for pointing out that pools have applications!
PVE/API2/Ceph/Pools.pm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
index 6c05250e..f5984c2c 100644
--- a/PVE/API2/Ceph/Pools.pm
+++ b/PVE/API2/Ceph/Pools.pm
@@ -125,6 +125,11 @@ __PACKAGE__->register_method ({
title => 'Autoscale Status',
optional => 1,
},
+ applications => {
+ type => 'object',
+ title => 'Associated Applications',
+ optional => 1,
+ },
},
},
links => [ { rel => 'child', href => "{pool_name}" } ],
@@ -167,6 +172,8 @@ __PACKAGE__->register_method ({
# pg_autoscaler module is not enabled in Nautilus
my $autoscale = eval { $get_autoscale_status->($rados) };
+ my $apps = eval { $rados->mon_command({ prefix => 'osd pool application get' }) };
+
foreach my $e (@{$res->{pools}}) {
my $d = {};
foreach my $attr (@$attr_list) {
@@ -191,6 +198,10 @@ __PACKAGE__->register_method ({
$d->{percent_used} = $s->{percent_used};
}
+ if ($apps) {
+ $d->{applications} = $apps->{$d->{pool_name}} if $apps->{$d->{pool_name}};
+ }
+
# Cephs numerical pool types are barely documented. Found the following in the Ceph
# codebase: https://github.com/ceph/ceph/blob/ff144995a849407c258bcb763daa3e03cfce5059/src/osd/osd_types.h#L1221-L1233
if ($e->{type} == 1) {
--
2.30.2
More information about the pve-devel
mailing list