From a028a5472c483ac7e88204bc10abc9a38353a95a Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Thu, 8 Dec 2022 11:58:37 -0700 Subject: [PATCH] filesystem: do not break on raid removal 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. --- subiquity/models/filesystem.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/subiquity/models/filesystem.py b/subiquity/models/filesystem.py index 1c1e594cf..5e23f7578 100644 --- a/subiquity/models/filesystem.py +++ b/subiquity/models/filesystem.py @@ -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: @@ -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):