Skip to content

Commit 88c8780

Browse files
authored
Merge pull request #22 from shibutd/fix-partition-table-parsing
CLOS-2786: Fix detection when a bootable partition in on RAID
2 parents 7d50c28 + b6f42ac commit 88c8780

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/libraries/scan_layout.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def get_partition_layout(device):
6565
if not line.startswith('Device'):
6666
continue
6767

68-
part_all_attrs = split_on_space_segments(line)
6968
break
7069

7170
partitions = []
@@ -76,7 +75,7 @@ def get_partition_layout(device):
7675

7776
# If the partition is not bootable, the Boot column might be empty
7877
part_device = part_info[0]
79-
part_start = int(part_info[2]) if len(part_info) == len(part_all_attrs) else int(part_info[1])
78+
part_start = int(part_info[2]) if part_info[1] == '*' else int(part_info[1])
8079
partitions.append(PartitionInfo(part_device=part_device, start_offset=part_start*unit))
8180

8281
return GRUBDevicePartitionLayout(device=device, partitions=partitions)

repos/system_upgrade/el7toel8/actors/scangrubdevpartitionlayout/tests/test_scan_partition_layout.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
)
3232
]
3333
)
34-
def test_get_partition_layout(monkeypatch, devices):
34+
@pytest.mark.parametrize('fs', ('Linux', 'Linux raid autodetect'))
35+
def test_get_partition_layout(monkeypatch, devices, fs):
3536
device_to_fdisk_output = {}
3637
for device in devices:
3738
fdisk_output = [
@@ -45,7 +46,7 @@ def test_get_partition_layout(monkeypatch, devices):
4546
' Device Boot Start End Blocks Id System',
4647
]
4748
for part in device.partitions:
48-
part_line = '{0} * {1} 2099199 1048576 83 Linux'.format(part.name, part.start_offset)
49+
part_line = '{0} * {1} 2099199 1048576 83 {2}'.format(part.name, part.start_offset, fs)
4950
fdisk_output.append(part_line)
5051

5152
device_to_fdisk_output[device.name] = fdisk_output

0 commit comments

Comments
 (0)