Skip to content

Commit

Permalink
storage: prevent erase and install with storage version 1
Browse files Browse the repository at this point in the history
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
  • Loading branch information
ogayot committed Dec 4, 2024
1 parent 304828e commit 5abdd91
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions subiquity/server/controllers/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,10 @@ def start_guided_erase_install(
there was free space before or after the partition being removed, it
will be included in the returned gap. Therefore gap.offset and gap.size
will not necessarily match partition.offset and partition.size."""
if self.model.storage_version < 2:
raise StorageRecoverableError(
'"Erase and Install" requires storage version 2'
)
partition = self.get_partition(disk, target.partition_number)
self.delete_partition(partition, override_preserve=True)
return gaps.find_gap_after_removal(disk, removed_partition=partition)
Expand Down Expand Up @@ -1283,6 +1287,8 @@ def available_erase_install_scenarios(
self, install_min: int
) -> list[tuple[int, GuidedStorageTargetEraseInstall]]:
scenarios: list[tuple[int, GuidedStorageTargetEraseInstall]] = []
if self.model.storage_version < 2:
return []

for disk in self.potential_boot_disks(check_boot=False):
# Skip RAID until we know how to proceed.
Expand Down

0 comments on commit 5abdd91

Please sign in to comment.