Change ELevate patch: update actor.py to support NVMe device enumeration

The package's .spec: update %changelog
This commit is contained in:
Yuriy Kohut 2024-04-24 11:11:29 +03:00
parent 6d0e0c6a66
commit a8101a4815
2 changed files with 24 additions and 7 deletions

View File

@ -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,6 +133,22 @@ index f42909f0..f08b7b82 100644
+ }
+
+ def devparts(dev):
+ """
+ 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];
@ -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('"'),

View File

@ -283,8 +283,9 @@ done;
# no files here
%changelog
* Tue Apr 23 2024 Yuriy Kohut <ykohut@almalinux.org> - 1:0.19.0-6
* Wed Apr 24 2024 Yuriy Kohut <ykohut@almalinux.org> - 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 <ykohut@almalinux.org> - 1:0.19.0-5
- AlmaLinux/CentOS/Oracle/Rocky/EuroLinux support (phase 1)