From: Dominik Csapak <d.csapak@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 1/4] ceph tools: set_pools: filter settings for erasure code pools
Date: Mon, 2 May 2022 09:10:07 +0200 [thread overview]
Message-ID: <15242dcb-0af7-e34a-47d4-d8219c348077@proxmox.com> (raw)
In-Reply-To: <20220429141655.2884387-1-a.lauterer@proxmox.com>
one minor nit inline
On 4/29/22 16:16, Aaron Lauterer wrote:
> Erasure code pools cannot change certain settings after creation.
> Trying to set them will cause errors on Cephs side.
>
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> PVE/Ceph/Tools.pm | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm
> index 7bd3eedc..65589820 100644
> --- a/PVE/Ceph/Tools.pm
> +++ b/PVE/Ceph/Tools.pm
> @@ -205,7 +205,7 @@ sub check_ceph_enabled {
> }
>
> my $set_pool_setting = sub {
> - my ($pool, $setting, $value) = @_;
> + my ($pool, $setting, $value, $rados) = @_;
>
> my $command;
> if ($setting eq 'application') {
> @@ -224,7 +224,7 @@ my $set_pool_setting = sub {
> };
> }
>
> - my $rados = PVE::RADOS->new();
> + $rados = PVE::RADOS->new() if !$rados;
> eval { $rados->mon_command($command); };
> return $@ ? $@ : undef;
> };
> @@ -232,6 +232,16 @@ my $set_pool_setting = sub {
> sub set_pool {
> my ($pool, $param) = @_;
>
> + my $rados = PVE::RADOS->new();
> +
> + if (get_pool_type($pool, $rados) eq 'erasure') {
> + #remove parameters that cannot be changed for erasure coded pools
> + my $ignore_params = ['size', 'crush_rule'];
> + for my $setting (@$ignore_params) {
> + print "cannot set '${setting}' for erasure coded pool\n";
i'd only print that line if there was actually a value there, else
every one gets those warnings even if they did not attempt to set e.g.
the size
> + delete $param->{$setting};
> + }
> + }
> # by default, pool size always resets min_size, so set it as first item
> # https://tracker.ceph.com/issues/44862
> my $keys = [ grep { $_ ne 'size' } sort keys %$param ];
> @@ -241,7 +251,7 @@ sub set_pool {
> my $value = $param->{$setting};
>
> print "pool $pool: applying $setting = $value\n";
> - if (my $err = $set_pool_setting->($pool, $setting, $value)) {
> + if (my $err = $set_pool_setting->($pool, $setting, $value, $rados)) {
> print "$err";
> } else {
> delete $param->{$setting};
> @@ -267,6 +277,12 @@ sub get_pool_properties {
> return $rados->mon_command($command);
> }
>
> +sub get_pool_type {
> + my ($pool, $rados) = @_;
> + return 'erasure' if get_pool_properties($pool, $rados)->{erasure_code_profile};
> + return 'replicated';
> +}
> +
> sub create_pool {
> my ($pool, $param, $rados) = @_;
> $rados = PVE::RADOS->new() if !defined($rados);
next prev parent reply other threads:[~2022-05-02 7:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-29 14:16 Aaron Lauterer
2022-04-29 14:16 ` [pve-devel] [PATCH manager 2/4] api: ceph pools: add type to returned properties Aaron Lauterer
2022-05-02 7:11 ` 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 ` Dominik Csapak [this message]
2022-05-02 7:13 ` [pve-devel] [PATCH manager 1/4] ceph tools: set_pools: filter settings for erasure code pools 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=15242dcb-0af7-e34a-47d4-d8219c348077@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=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 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