use alignment_data() in PartitionStretchy

also add alignment_data() to Raid
This commit is contained in:
Michael Hudson-Doyle 2022-03-11 10:22:03 +13:00
parent 510d63d93d
commit 7b36b1907a
2 changed files with 7 additions and 5 deletions

View File

@ -758,6 +758,10 @@ class Raid(_Device):
return s
return get_raid_size(self.raidlevel, self.devices)
def alignment_data(self):
ptable = self.ptable_for_new_partition()
return self._m._partition_alignment_data[ptable]
@property
def available_for_partitions(self):
# For some reason, the overhead on RAID devices seems to be

View File

@ -57,9 +57,6 @@ from subiquity.ui.mount import (
log = logging.getLogger('subiquity.ui.views.filesystem.partition')
DEFAULT_ALIGNMENT = 1 << 20
class FSTypeField(FormField):
takes_default_style = False
@ -383,7 +380,7 @@ class PartitionStretchy(Stretchy):
alignment = LVM_CHUNK_SIZE
lvm_names = {p.name for p in disk.partitions()}
else:
alignment = DEFAULT_ALIGNMENT
alignment = disk.alignment_data().part_align
lvm_names = None
if self.partition:
if partition.flag in ["bios_grub", "prep"]:
@ -576,7 +573,8 @@ class FormatEntireStretchy(Stretchy):
elif not isinstance(device, Disk):
initial['fstype'] = 'ext4'
self.form = PartitionForm(
self.model, 0, initial, None, device, DEFAULT_ALIGNMENT)
self.model, 0, initial, None, device,
alignment=device.alignment_data().part_align)
self.form.remove_field('size')
self.form.remove_field('name')