storage/v2: report grub_device on disk
If a partition has grub_device, that is shown at the disk level as well.
This commit is contained in:
parent
491842f15f
commit
f17139c4a0
|
@ -260,6 +260,12 @@ def for_client(device, *, min_size=0):
|
||||||
def _for_client_disk(disk, *, min_size=0):
|
def _for_client_disk(disk, *, min_size=0):
|
||||||
path = getattr(disk, 'path', None)
|
path = getattr(disk, 'path', None)
|
||||||
grub_device = getattr(disk, 'grub_device', False)
|
grub_device = getattr(disk, 'grub_device', False)
|
||||||
|
if not grub_device:
|
||||||
|
for part in disk._partitions:
|
||||||
|
if part.flag in ['bios_grub', 'prep'] or part.grub_device:
|
||||||
|
grub_device = True
|
||||||
|
break
|
||||||
|
|
||||||
return types.Disk(
|
return types.Disk(
|
||||||
id=disk.id,
|
id=disk.id,
|
||||||
label=label(disk),
|
label=label(disk),
|
||||||
|
|
|
@ -277,7 +277,7 @@ class TestAdd(TestAPI):
|
||||||
}
|
}
|
||||||
single_add = await inst.post('/storage/v2/add_partition', data)
|
single_add = await inst.post('/storage/v2/add_partition', data)
|
||||||
self.assertEqual(2, len(single_add['disks'][0]['partitions']))
|
self.assertEqual(2, len(single_add['disks'][0]['partitions']))
|
||||||
# self.assertTrue(single_add['disks'][0]['grub_device'])
|
self.assertTrue(single_add['disks'][0]['grub_device'])
|
||||||
|
|
||||||
await inst.post('/storage/v2/reset')
|
await inst.post('/storage/v2/reset')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue