From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id A6E5F1FF2C6 for ; Wed, 10 Jul 2024 13:05:20 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4353F7AE2; Wed, 10 Jul 2024 13:05:44 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Wed, 10 Jul 2024 13:05:34 +0200 Message-Id: <20240710110534.9215-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.075 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. [proxmox.com, pmg7to8.pm] Subject: [pmg-devel] applied: [PATCH pmg-api] pmg7to8: allow arbitrary newer running -pve kernels after upgrade X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pmg-devel-bounces@lists.proxmox.com Sender: "pmg-devel" follows/copied from commit fb59038a8b110b0b0b438ec035fd41dd9d591232 from pve-manager. Reported in our community forum: https://forum.proxmox.com/threads/.150959/ Signed-off-by: Stoiko Ivanov --- applied it directly after testing src/PMG/CLI/pmg7to8.pm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/PMG/CLI/pmg7to8.pm b/src/PMG/CLI/pmg7to8.pm index 6d2f6fa..d0a6cbe 100644 --- a/src/PMG/CLI/pmg7to8.pm +++ b/src/PMG/CLI/pmg7to8.pm @@ -193,17 +193,30 @@ sub check_pmg_packages { } # FIXME: better differentiate between 6.2 from bullseye or bookworm - my ($krunning, $kinstalled) = (qr/6\.(?:2\.(?:[2-9]\d+|1[6-8]|1\d\d+)|5)[^~]*$/, 'proxmox-kernel-6.2'); + my $kinstalled = 'proxmox-kernel-6.2'; if (!$upgraded) { # we got a few that avoided 5.15 in cluster with mixed CPUs, so allow older too - ($krunning, $kinstalled) = (qr/(?:5\.(?:13|15)|6\.2)/, 'pve-kernel-5.15'); + $kinstalled = 'pve-kernel-5.15'; } + my $kernel_version_is_expected = sub { + my ($version) = @_; + + return $version =~ m/^(?:5\.(?:13|15)|6\.2)/ if !$upgraded; + + if ($version =~ m/^6\.(?:2\.(?:[2-9]\d+|1[6-8]|1\d\d+)|5)[^~]*$/) { + return 1; + } elsif ($version =~ m/^(\d+).(\d+)[^~]*-pve$/) { + return $1 >= 6 && $2 >= 2; + } + return 0; + }; + print "\nChecking running kernel version..\n"; my $kernel_ver = $pmg->{RunningKernel}; if (!defined($kernel_ver)) { log_fail("unable to determine running kernel version."); - } elsif ($kernel_ver =~ /^$krunning/) { + } elsif ($kernel_version_is_expected->($kernel_ver)) { if ($upgraded) { log_pass("running new kernel '$kernel_ver' after upgrade."); } else { @@ -216,7 +229,7 @@ sub check_pmg_packages { log_warn("unexpected running and installed kernel '$kernel_ver'."); } - if ($upgraded && $kernel_ver =~ /^$krunning/) { + if ($upgraded && $kernel_version_is_expected->($kernel_ver)) { my $outdated_kernel_meta_pkgs = []; for my $kernel_meta_version ('5.4', '5.11', '5.13', '5.15') { my $pkg = "pve-kernel-${kernel_meta_version}"; -- 2.39.2 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel