57 lines
3.0 KiB
Diff
57 lines
3.0 KiB
Diff
From 0bf07d1546ccdc6d4a9e6f4936a98b4d6ca27789 Mon Sep 17 00:00:00 2001
|
|
From: Petr Stodulka <pstodulk@redhat.com>
|
|
Date: Tue, 12 Nov 2024 09:10:50 +0100
|
|
Subject: [PATCH 26/40] scangrubdevpartitionlayout: Skip warning msgs
|
|
|
|
The fdisk output can contain warning msgs when a partition is not
|
|
aligned on physical sector boundary, like:
|
|
Partition 4 does not start on physical sector boundary.
|
|
We know that in case of MBR the line we expect to parse always
|
|
starts with canonical path. So let's skip all lines which does
|
|
not start with '/'.
|
|
|
|
jira: https://issues.redhat.com/browse/RHEL-50947
|
|
---
|
|
.../libraries/scan_layout.py | 10 ++++++++++
|
|
.../tests/test_scan_partition_layout.py | 3 +++
|
|
2 files changed, 13 insertions(+)
|
|
|
|
diff --git a/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/libraries/scan_layout.py b/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/libraries/scan_layout.py
|
|
index 83d02656..7f4a2a59 100644
|
|
--- a/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/libraries/scan_layout.py
|
|
+++ b/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/libraries/scan_layout.py
|
|
@@ -68,6 +68,16 @@ def get_partition_layout(device):
|
|
|
|
partitions = []
|
|
for partition_line in table_iter:
|
|
+ if not partition_line.startswith('/'):
|
|
+ # the output can contain warning msg when a partition is not aligned
|
|
+ # on physical sector boundary, like:
|
|
+ # ~~~
|
|
+ # Partition 4 does not start on physical sector boundary.
|
|
+ # ~~~
|
|
+ # We know that in case of MBR the line we expect to parse always
|
|
+ # starts with canonical path. So let's use this condition.
|
|
+ # See https://issues.redhat.com/browse/RHEL-50947
|
|
+ continue
|
|
# Fields: Device Boot Start End Sectors Size Id Type
|
|
# The line looks like: `/dev/vda1 * 2048 2099199 2097152 1G 83 Linux`
|
|
part_info = split_on_space_segments(partition_line)
|
|
diff --git a/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/tests/test_scan_partition_layout.py b/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/tests/test_scan_partition_layout.py
|
|
index 743ca71f..9c32e16f 100644
|
|
--- a/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/tests/test_scan_partition_layout.py
|
|
+++ b/repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/tests/test_scan_partition_layout.py
|
|
@@ -49,6 +49,9 @@ def test_get_partition_layout(monkeypatch, devices, fs):
|
|
part_line = '{0} * {1} 2099199 1048576 83 {2}'.format(part.name, part.start_offset, fs)
|
|
fdisk_output.append(part_line)
|
|
|
|
+ # add a problematic warning msg to test:
|
|
+ # https://issues.redhat.com/browse/RHEL-50947
|
|
+ fdisk_output.append('Partition 3 does not start on physical sector boundary.')
|
|
device_to_fdisk_output[device.name] = fdisk_output
|
|
|
|
def mocked_run(cmd, *args, **kwargs):
|
|
--
|
|
2.47.0
|
|
|