Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detection when a bootable partition in on RAID #1260

Merged
merged 1 commit into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def get_partition_layout(device):
if not line.startswith('Device'):
continue

part_all_attrs = split_on_space_segments(line)
break

partitions = []
Expand All @@ -75,7 +74,7 @@ def get_partition_layout(device):

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

return GRUBDevicePartitionLayout(device=device, partitions=partitions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
)
]
)
def test_get_partition_layout(monkeypatch, devices):
@pytest.mark.parametrize('fs', ('Linux', 'Linux raid autodetect'))
def test_get_partition_layout(monkeypatch, devices, fs):
device_to_fdisk_output = {}
for device in devices:
fdisk_output = [
Expand All @@ -45,7 +46,7 @@ def test_get_partition_layout(monkeypatch, devices):
' Device Boot Start End Blocks Id System',
]
for part in device.partitions:
part_line = '{0} * {1} 2099199 1048576 83 Linux'.format(part.name, part.start_offset)
part_line = '{0} * {1} 2099199 1048576 83 {2}'.format(part.name, part.start_offset, fs)
fdisk_output.append(part_line)

device_to_fdisk_output[device.name] = fdisk_output
Expand Down