filesystem: no guided UseGap when disk is empty
This commit is contained in:
parent
be805ffb36
commit
be4cd23ffe
|
@ -405,6 +405,10 @@ class FilesystemController(SubiquityController, FilesystemManipulator):
|
|||
scenarios.append((disk.size, reformat))
|
||||
|
||||
for disk in self.get_guided_disks(with_reformatting=False):
|
||||
if len(disk.partitions()) < 1:
|
||||
# On an empty disk, don't bother to offer it with UseGap, as
|
||||
# it's basically the same as the Reformat case.
|
||||
continue
|
||||
gap = gaps.largest_gap(disk)
|
||||
if gap is not None and gap.size >= install_min:
|
||||
api_gap = labels.for_client(gap)
|
||||
|
|
|
@ -159,13 +159,10 @@ class TestGuidedV2(IsolatedAsyncioTestCase):
|
|||
|
||||
@parameterized.expand(bootloaders)
|
||||
async def test_blank_disk(self, bootloader):
|
||||
# blank disks should not report a UseGap case
|
||||
self._setup(bootloader)
|
||||
d = make_disk(self.model, size=(30 << 30) + (2 << 20))
|
||||
gap = types.Gap(offset=1 << 20, size=30 << 30)
|
||||
expected = [
|
||||
GuidedStorageTargetReformat(disk_id=d.id),
|
||||
GuidedStorageTargetUseGap(disk_id=d.id, gap=gap),
|
||||
]
|
||||
expected = [GuidedStorageTargetReformat(disk_id=d.id)]
|
||||
resp = await self.fsc.v2_guided_GET()
|
||||
self.assertEqual(expected, resp.possible)
|
||||
|
||||
|
|
Loading…
Reference in New Issue