From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id DDA691FF2C6 for ; Tue, 9 Jul 2024 13:41:29 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6CFBF1E85D; Tue, 9 Jul 2024 13:41:50 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Tue, 9 Jul 2024 13:41:16 +0200 Message-Id: <20240709114116.208276-1-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.040 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [tools.pm] Subject: [pve-devel] [PATCH manager] fix #5010: ceph: pool set only changed properties X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" By only setting propterties that have changed, we can avoid potential errors in the task. For example, if one configures the "nosizechange" property on a pool, to prevent accidential size changes, the task will now only error if the user is actually trying to change the size. Prior to this patch, we would always try to set all parameters, even if they were the same value. In the above example, this would result in the task ending in error state, as we are not allowed to change the size. To disable size changing you can run the following command: ceph osd pool set {pool} nosizechange 1 Signed-off-by: Aaron Lauterer --- I am not sure if we want to log every property that is skipped. It makes visible what is done, but is also a bit noisy. PVE/Ceph/Tools.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PVE/Ceph/Tools.pm b/PVE/Ceph/Tools.pm index 9b97171e..dd27e7ce 100644 --- a/PVE/Ceph/Tools.pm +++ b/PVE/Ceph/Tools.pm @@ -262,9 +262,17 @@ sub set_pool { my $keys = [ grep { $_ ne 'size' } sort keys %$param ]; unshift @$keys, 'size' if exists $param->{size}; + my $current_properties = get_pool_properties($pool, $rados); + for my $setting (@$keys) { my $value = $param->{$setting}; + if (defined($current_properties->{$setting}) && $value eq $current_properties->{$setting}) { + print "skipping '${setting}', did not change\n"; + delete $param->{$setting}; + next; + } + print "pool $pool: applying $setting = $value\n"; if (my $err = $set_pool_setting->($pool, $setting, $value, $rados)) { print "$err"; -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel