Merge pull request #1208 from mwhudson/alignment-data-ui

use alignment_data() in PartitionStretchy
This commit is contained in:
Michael Hudson-Doyle 2022-03-11 11:22:26 +13:00 committed by GitHub
commit 68dd1eb660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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')