Skip to content

Commit

Permalink
maybe a good idea?
Browse files Browse the repository at this point in the history
  • Loading branch information
mwhudson committed Nov 29, 2022
1 parent b61874a commit 44fca22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion subiquity/models/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,7 +1586,14 @@ def _remove(self, obj):
self._actions.remove(obj)

def add_partition(self, device, *, size, offset, flag="", wipe=None,
grub_device=None, partition_name=None):
grub_device=None, partition_name=None,
check_alignment=True):
align = device.alignment_data().part_align
if check_alignment:
if offset % align != 0 or size % align != 0:
raise Exception(
"size %s or offset %s not aligned to %s",
size, offset, align)
from subiquity.common.filesystem import boot
if device._fs is not None:
raise Exception("%s is already formatted" % (device,))
Expand Down
3 changes: 2 additions & 1 deletion subiquity/server/controllers/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@ def apply_system(self, disk_id):
structure == volume.structure[-1]:
gap = gaps.largest_gap(disk)
size = gap.size - (offset - gap.offset)
part = self.model.add_partition(disk, offset=offset, size=size)
part = self.model.add_partition(
disk, offset=offset, size=size, check_alignment=False)

type_uuid = structure.gpt_part_type_uuid()
if type_uuid:
Expand Down

0 comments on commit 44fca22

Please sign in to comment.