Skip to content

Commit

Permalink
filesystem: do not break on raid removal
Browse files Browse the repository at this point in the history
This logical partition handler can be moved up to _device, and this is
needed in case we are doing removals of anything that isn't a Disk.
  • Loading branch information
dbungert committed Dec 8, 2022
1 parent aa1ab44 commit a028a54
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions subiquity/models/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,14 @@ def has_unavailable_partition(self):
def _has_preexisting_partition(self):
return any(p.preserve for p in self._partitions)

def renumber_logical_partitions(self, removed_partition):
parts = [p for p in self.partitions_by_number()
if p.is_logical and p.number > removed_partition.number]
next_num = removed_partition.number
for part in parts:
part.number = next_num
next_num += 1


@fsobj("dasd")
class Dasd:
Expand Down Expand Up @@ -695,14 +703,6 @@ def _decode_id(self, id):
return None
return id.encode('utf-8').decode('unicode_escape').strip()

def renumber_logical_partitions(self, removed_partition):
parts = [p for p in self.partitions_by_number()
if p.is_logical and p.number > removed_partition.number]
next_num = removed_partition.number
for part in parts:
part.number = next_num
next_num += 1


@fsobj("partition")
class Partition(_Formattable):
Expand Down

0 comments on commit a028a54

Please sign in to comment.