diff --git a/subiquity/controllers/filesystem.py b/subiquity/controllers/filesystem.py index f31c0f9c..86fcbf5f 100644 --- a/subiquity/controllers/filesystem.py +++ b/subiquity/controllers/filesystem.py @@ -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): diff --git a/subiquity/controllers/tests/test_filesystem.py b/subiquity/controllers/tests/test_filesystem.py index 055ed3e9..7274d0ed 100644 --- a/subiquity/controllers/tests/test_filesystem.py +++ b/subiquity/controllers/tests/test_filesystem.py @@ -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)