From a8101a481547cbd710f7d8ffa18f79b72ea59f22 Mon Sep 17 00:00:00 2001 From: Yuriy Kohut Date: Wed, 24 Apr 2024 11:11:29 +0300 Subject: [PATCH] Change ELevate patch: update actor.py to support NVMe device enumeration The package's .spec: update %changelog --- SOURCES/leapp-repository-0.19.0-elevate.patch | 28 +++++++++++++++---- SPECS/leapp-repository.spec | 3 +- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/SOURCES/leapp-repository-0.19.0-elevate.patch b/SOURCES/leapp-repository-0.19.0-elevate.patch index 8798a65..f0dda33 100644 --- a/SOURCES/leapp-repository-0.19.0-elevate.patch +++ b/SOURCES/leapp-repository-0.19.0-elevate.patch @@ -82,10 +82,10 @@ index 5cc6fd92..fe81626f 100755 # This should not happen as /etc/initrd-release is supposed to have API # stability, but check is better than broken system. diff --git a/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py b/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py -index f42909f0..f08b7b82 100644 +index f42909f0..4a2bc8ad 100644 --- a/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py +++ b/repos/system_upgrade/common/actors/efibootorderfix/finalization/actor.py -@@ -1,17 +1,102 @@ +@@ -1,17 +1,118 @@ +import os +import re + @@ -133,8 +133,24 @@ index f42909f0..f08b7b82 100644 + } + + def devparts(dev): -+ part = next(re.finditer(r'\d+$', dev)).group(0) -+ dev = dev[:-len(part)] ++ """ ++ NVMe block devices aren't named like SCSI/ATA/etc block devices and must be parsed differently. ++ SCSI/ATA/etc devices have a syntax resembling /dev/sdb4 for the 4th partition on the 2nd disk. ++ NVMe devices have a syntax resembling /dev/nvme0n2p4 for the 4th partition on the 2nd disk. ++ """ ++ if '/dev/nvme' in dev: ++ """ ++ NVMe ++ """ ++ part = next(re.finditer(r'p\d+$', dev)).group(0) ++ dev = dev[:-len(part)] ++ part = part[1:] ++ else: ++ """ ++ Non-NVMe (SCSI, ATA, etc) ++ """ ++ part = next(re.finditer(r'\d+$', dev)).group(0) ++ dev = dev[:-len(part)] + return [dev, part]; + + with open('/etc/system-release', 'r') as sr: @@ -193,7 +209,7 @@ index f42909f0..f08b7b82 100644 + if not has_grub_cfg: + run(['/sbin/grub2-mkconfig', '-o', grub_cfg_path]) diff --git a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py -index 9e213f64..7abb2b42 100644 +index 9e213f64..52cfe14f 100644 --- a/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py +++ b/repos/system_upgrade/common/actors/ipuworkflowconfig/libraries/ipuworkflowconfig.py @@ -47,15 +47,20 @@ def get_os_release(path): @@ -206,7 +222,7 @@ index 9e213f64..7abb2b42 100644 data = dict(l.strip().split('=', 1) for l in f.readlines() if '=' in l) + release_id = data.get('ID', '').strip('"') + version_id = data.get('VERSION_ID', '').strip('"') -+ if release_id == 'centos' and '.' not in version_id: ++ if release_id == 'centos' and '.' not in os_version: + os_version = "{}.999".format(version_id) return OSRelease( - release_id=data.get('ID', '').strip('"'), diff --git a/SPECS/leapp-repository.spec b/SPECS/leapp-repository.spec index c79c2c6..16c8b76 100644 --- a/SPECS/leapp-repository.spec +++ b/SPECS/leapp-repository.spec @@ -283,8 +283,9 @@ done; # no files here %changelog -* Tue Apr 23 2024 Yuriy Kohut - 1:0.19.0-6 +* Wed Apr 24 2024 Yuriy Kohut - 1:0.19.0-6 - Enable CentOS Stream release 8 to 9 elevation +- Update actor.py to support NVMe device enumeration * Wed Jan 10 2024 Yuriy Kohut - 1:0.19.0-5 - AlmaLinux/CentOS/Oracle/Rocky/EuroLinux support (phase 1)