From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id EC5179D2CB for ; Fri, 2 Jun 2023 18:04:04 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D5E632D753 for ; Fri, 2 Jun 2023 18:04:04 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 2 Jun 2023 18:04:03 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 83F5448448 for ; Fri, 2 Jun 2023 18:04:03 +0200 (CEST) From: Aaron Lauterer To: pve-devel@lists.proxmox.com Date: Fri, 2 Jun 2023 18:04:02 +0200 Message-Id: <20230602160402.164448-1-a.lauterer@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.092 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 T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [pve7to8.pm] Subject: [pve-devel] [PATCH] pve7to8: ceph version check: ignore commit hash 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: , X-List-Received-Date: Fri, 02 Jun 2023 16:04:05 -0000 The commit hash of the Ceph version might be different between major releases. For example: ceph version 17.2.6 (810db68029296377607028a6c6da1ec06f5a2b27) quincy (stable) ceph version 17.2.6 (995dec2cdae920da21db2d455e55efbc339bde24) quincy (stable) This can lead to unnecessary warnings of multiple detected versions. Therefore, extract the version, e.g. 'ceph version 17.2.6', and the commit hash. Use the simplified version for the version checks and show an info line when the commit is different instead of a warning. If the commit hashes are the only difference, we are likely in the middle of the upgrade. Signed-off-by: Aaron Lauterer --- PVE/CLI/pve7to8.pm | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/PVE/CLI/pve7to8.pm b/PVE/CLI/pve7to8.pm index 06f4e2bb..cc2bd643 100644 --- a/PVE/CLI/pve7to8.pm +++ b/PVE/CLI/pve7to8.pm @@ -500,9 +500,24 @@ sub check_ceph { { 'key' => 'osd', 'name' => 'OSD' }, ]; + my $ceph_versions_simple = {}; + my $ceph_versions_commits = {}; + for my $type (keys %$ceph_versions) { + for my $full_version (keys $ceph_versions->{$type}->%*) { + if ($full_version =~ m/^(.*) \((.*)\).*\(.*\)$/) { + # String is in the form of + # ceph version 17.2.6 (810db68029296377607028a6c6da1ec06f5a2b27) quincy (stable) + # only check the first part, e.g. 'ceph version 17.2.6', the commit hash can + # be different + $ceph_versions_simple->{$type}->{$1} = 1; + $ceph_versions_commits->{$type}->{$2} = 1; + } + } + } + foreach my $service (@$services) { my ($name, $key) = $service->@{'name', 'key'}; - if (my $service_versions = $ceph_versions->{$key}) { + if (my $service_versions = $ceph_versions_simple->{$key}) { if (keys %$service_versions == 0) { log_skip("no running instances detected for daemon type $name."); } elsif (keys %$service_versions == 1) { @@ -513,6 +528,12 @@ sub check_ceph { } else { log_skip("unable to determine versions of running Ceph $name instances."); } + if (my $service_commits = $ceph_versions_commits->{$key}) { + if (keys %$service_commits > 1) { + log_info("multiple version commits detected for daemon type $name. ". + "Are you in the middle of the upgrade?"); + } + } } my $overall_versions = $ceph_versions->{overall}; @@ -521,7 +542,7 @@ sub check_ceph { } elsif (keys %$overall_versions == 1) { log_pass("single running overall version detected for all Ceph daemon types."); $noout_wanted = 0; # off post-upgrade, on pre-upgrade - } else { + } elsif (keys $ceph_versions_simple->{overall}->%* != 1) { log_warn("overall version mismatch detected, check 'ceph versions' output for details!"); } } -- 2.30.2