From: Stefan Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager v2 1/2] api: ceph: add applications of each pool to the lspool endpoint
Date: Wed, 19 Oct 2022 14:16:43 +0200 [thread overview]
Message-ID: <20221019121644.362690-1-s.sterz@proxmox.com> (raw)
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 that information
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
even though an application needs to be defined for a pool since
luminous, i tried to make this code fail gracefully in the case the
rados mon command fails or there is no application for a given pool.
thanks @ alwin antreich for pointing out that pools have applications!
PVE/API2/Ceph/Pools.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
index 6c05250e..607b6c17 100644
--- a/PVE/API2/Ceph/Pools.pm
+++ b/PVE/API2/Ceph/Pools.pm
@@ -167,6 +167,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 +193,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
next reply other threads:[~2022-10-19 12:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-19 12:16 Stefan Sterz [this message]
2022-10-19 12:16 ` [pve-devel] [PATCH manager v2 2/2] ui: remove ceph-mgr pools from rbd pool selection Stefan Sterz
2022-10-19 12:33 ` Stefan Sterz
[not found] ` <F3981051-D632-4BD7-8BC3-DE8E6BA4050D@antreich.com>
2022-10-20 7:19 ` Stefan Sterz
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=20221019121644.362690-1-s.sterz@proxmox.com \
--to=s.sterz@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