all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Sterz <s.sterz@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH manager v3 1/2] api: ceph: add applications of each pool to the lspools endpoint
Date: Fri, 21 Oct 2022 08:57:36 +0200	[thread overview]
Message-ID: <8f6f8f15-31bd-f6c5-44e3-09b64e749761@proxmox.com> (raw)
In-Reply-To: <47cbf07a-d82f-618e-7d11-28d49ebdffb6@proxmox.com>

On 10/20/22 14:55, Thomas Lamprecht wrote:
> Am 20/10/2022 um 09:17 schrieb Stefan Sterz:
>> 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@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' }) };
> 
> out of interest: how expensive is this, did you check the overhead?
> 

do you want a specific metric? in my (admittedly small) test setup
(three vm cluster with 4 cores and 4Gib RAM) it is barely noticeable.
the api call takes between 18 and 25ms in both cases for me.

>> +
>>  	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}};
> 
> no nested hashes-in-hashes, pull out $d->{pool_name} earlier and then make it an one
> liner:
> 
> $d->{applications} = $apps->{$pool} if defined($apps->{$pool});
> 

noted, ill avoid that in the future.

>> +	    }
>> +
>>  	    # 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) {
> 





  reply	other threads:[~2022-10-21  6:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  7:17 Stefan Sterz
2022-10-20  7:17 ` [pve-devel] [PATCH manager v3 2/2] ui: only allow rbd pools to be added as rbd storage Stefan Sterz
2022-10-20 13:00   ` Thomas Lamprecht
2022-10-21  7:02     ` Stefan Sterz
2022-10-21  7:13       ` Thomas Lamprecht
2022-10-20 12:55 ` [pve-devel] [PATCH manager v3 1/2] api: ceph: add applications of each pool to the lspools endpoint Thomas Lamprecht
2022-10-21  6:57   ` Stefan Sterz [this message]
2022-10-21  7:04     ` Thomas Lamprecht
2022-10-21  7:59       ` Stefan Sterz
2022-10-21  9:54         ` 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=8f6f8f15-31bd-f6c5-44e3-09b64e749761@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal