mounting a partition of a disk that can be the boot disk makes it the boot disk
This commit is contained in:
parent
52ee6cdde1
commit
e63204afa9
|
@ -258,6 +258,11 @@ class FilesystemController(BaseController):
|
|||
if spec.get('mount') is None:
|
||||
return
|
||||
mount = self.model.add_mount(fs, spec['mount'])
|
||||
if self.model.needs_bootloader_partition():
|
||||
vol = fs.volume
|
||||
if vol.type == "partition" and vol.device.type == "disk":
|
||||
if vol.device._can_be_boot_disk():
|
||||
self.make_boot_disk(vol.device)
|
||||
return mount
|
||||
|
||||
def delete_mount(self, mount):
|
||||
|
|
|
@ -225,3 +225,17 @@ class TestFilesystemController(unittest.TestCase):
|
|||
self.assertEqual(
|
||||
controller.model.grub_install_device,
|
||||
disk2.partitions()[0])
|
||||
|
||||
def test_mounting_partition_makes_boot_disk(self):
|
||||
controller = make_controller(Bootloader.UEFI)
|
||||
disk1 = make_disk(controller.model, preserve=True)
|
||||
disk1p1 = controller.model.add_partition(
|
||||
disk1, size=512 << 20, flag="boot")
|
||||
disk1p1.preserve = True
|
||||
disk1p2 = controller.model.add_partition(
|
||||
disk1, size=disk1.free_for_partitions)
|
||||
disk1p2.preserve = True
|
||||
controller.partition_disk_handler(
|
||||
disk1, disk1p2, {'fstype': 'ext4', 'mount': '/'})
|
||||
efi_mnt = controller.model._mount_for_path("/boot/efi")
|
||||
self.assertEqual(efi_mnt.device.volume, disk1p1)
|
||||
|
|
Loading…
Reference in New Issue