storage/v2: mark can_be_boot_device on disks
(cherry picked from commit 3a0e9ed425
)
This commit is contained in:
parent
8533f57e9d
commit
7421bf7114
|
@ -306,6 +306,7 @@ def _for_client_disk(disk, *, min_size=0):
|
|||
usage_labels=usage_labels(disk),
|
||||
partitions=[for_client(p) for p in gaps.parts_and_gaps(disk)],
|
||||
boot_device=boot.is_boot_device(disk),
|
||||
can_be_boot_device=boot.can_be_boot_device(disk),
|
||||
ok_for_guided=disk.size >= min_size,
|
||||
model=getattr(disk, 'model', None),
|
||||
vendor=getattr(disk, 'vendor', None))
|
||||
|
|
|
@ -311,6 +311,7 @@ class Disk:
|
|||
preserve: bool
|
||||
path: Optional[str]
|
||||
boot_device: bool
|
||||
can_be_boot_device: bool
|
||||
model: Optional[str] = None
|
||||
vendor: Optional[str] = None
|
||||
|
||||
|
|
|
@ -510,7 +510,12 @@ class TestManualBoot(IsolatedAsyncioTestCase):
|
|||
self.app = make_app()
|
||||
self.app.opts.bootloader = bootloader.value
|
||||
self.fsc = FilesystemController(app=self.app)
|
||||
self.fsc.calculate_suggested_install_min = mock.Mock()
|
||||
self.fsc.calculate_suggested_install_min.return_value = 10 << 30
|
||||
self.fsc.model = self.model = make_model(bootloader)
|
||||
self.model.storage_version = 2
|
||||
self.fsc._probe_task.task = mock.Mock()
|
||||
self.fsc._get_system_task.task = mock.Mock()
|
||||
|
||||
@parameterized.expand(bootloaders_and_ptables)
|
||||
async def test_get_boot_disks_only(self, bootloader, ptable):
|
||||
|
@ -518,6 +523,9 @@ class TestManualBoot(IsolatedAsyncioTestCase):
|
|||
disk = make_disk(self.model)
|
||||
self.assertEqual([disk.id],
|
||||
await self.fsc.v2_potential_boot_disks_GET())
|
||||
resp = await self.fsc.v2_GET()
|
||||
[d] = resp.disks
|
||||
self.assertTrue(d.can_be_boot_device)
|
||||
|
||||
@parameterized.expand(bootloaders_and_ptables)
|
||||
async def test_get_boot_disks_none(self, bootloader, ptable):
|
||||
|
@ -531,6 +539,10 @@ class TestManualBoot(IsolatedAsyncioTestCase):
|
|||
d2 = make_disk(self.model)
|
||||
self.assertEqual(set([d1.id, d2.id]),
|
||||
set(await self.fsc.v2_potential_boot_disks_GET()))
|
||||
resp = await self.fsc.v2_GET()
|
||||
[d1, d2] = resp.disks
|
||||
self.assertTrue(d1.can_be_boot_device)
|
||||
self.assertTrue(d2.can_be_boot_device)
|
||||
|
||||
@parameterized.expand(bootloaders_and_ptables)
|
||||
async def test_get_boot_disks_some(self, bootloader, ptable):
|
||||
|
@ -548,6 +560,10 @@ class TestManualBoot(IsolatedAsyncioTestCase):
|
|||
self.assertEqual(expected,
|
||||
set(await self.fsc.v2_potential_boot_disks_GET()))
|
||||
|
||||
resp = await self.fsc.v2_GET()
|
||||
for d in resp.disks:
|
||||
self.assertEqual(d.id in expected, d.can_be_boot_device)
|
||||
|
||||
|
||||
class TestCoreBootInstallMethods(IsolatedAsyncioTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue