public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/4] api: ceph pools: add type to returned properties
Date: Fri, 29 Apr 2022 16:16:53 +0200	[thread overview]
Message-ID: <20220429141655.2884387-2-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20220429141655.2884387-1-a.lauterer@proxmox.com>

The osd dump already contains the pool type in numerical format.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
 PVE/API2/Ceph/Pools.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
index efdee360..b93f87e4 100644
--- a/PVE/API2/Ceph/Pools.pm
+++ b/PVE/API2/Ceph/Pools.pm
@@ -66,6 +66,11 @@ __PACKAGE__->register_method ({
 		    type => 'integer',
 		    title => 'Size',
 		},
+		type => {
+		    type => 'string',
+		    title => 'Type',
+		    enum => ['replicated', 'erasure', 'unknown'],
+		},
 		min_size => {
 		    type => 'integer',
 		    title => 'Min Size',
@@ -185,6 +190,15 @@ __PACKAGE__->register_method ({
 		$d->{bytes_used} = $s->{bytes_used};
 		$d->{percent_used} = $s->{percent_used};
 	    }
+
+	    if ($e->{type} == 1) {
+		$d->{type} = 'replicated';
+	    } elsif ($e->{type} == 3) {
+		$d->{type} = 'erasure';
+	    } else {
+		# we should never get here, but better be safe
+		$d->{type} = 'unknown';
+	    }
 	    push @$data, $d;
 	}
 
-- 
2.30.2





  reply	other threads:[~2022-04-29 14:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29 14:16 [pve-devel] [PATCH manager 1/4] ceph tools: set_pools: filter settings for erasure code pools Aaron Lauterer
2022-04-29 14:16 ` Aaron Lauterer [this message]
2022-05-02  7:11   ` [pve-devel] [PATCH manager 2/4] api: ceph pools: add type to returned properties Dominik Csapak
2022-05-02  7:19     ` Aaron Lauterer
2022-04-29 14:16 ` [pve-devel] [PATCH manager 3/4] ui: ceph pool edit: disable size and crush rule for erasure pools Aaron Lauterer
2022-04-29 14:16 ` [pve-devel] [PATCH manager 4/4] ui: ceph pools: add pool type column Aaron Lauterer
2022-05-02  7:10 ` [pve-devel] [PATCH manager 1/4] ceph tools: set_pools: filter settings for erasure code pools Dominik Csapak
2022-05-02  7:13 ` Dominik Csapak

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=20220429141655.2884387-2-a.lauterer@proxmox.com \
    --to=a.lauterer@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal