public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pmg-devel] applied: [PATCH pmg-api] pmg7to8: allow arbitrary newer running -pve kernels after upgrade
@ 2024-07-10 11:05 Stoiko Ivanov
  0 siblings, 0 replies; only message in thread
From: Stoiko Ivanov @ 2024-07-10 11:05 UTC (permalink / raw)
  To: 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 <s.ivanov@proxmox.com>
---
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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-07-10 11:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-10 11:05 [pmg-devel] applied: [PATCH pmg-api] pmg7to8: allow arbitrary newer running -pve kernels after upgrade Stoiko Ivanov

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