diff --git a/qubes/storage/kernels.py b/qubes/storage/kernels.py index a1a6b18d..b39d8b3d 100644 --- a/qubes/storage/kernels.py +++ b/qubes/storage/kernels.py @@ -105,10 +105,6 @@ class LinuxModules(Volume): return False def start(self): - path = self.path - if path and not os.path.exists(path): - raise StoragePoolException('Missing kernel modules: %s' % path) - return self def stop(self): @@ -116,12 +112,15 @@ class LinuxModules(Volume): def verify(self): if self.vid: - _check_path(self.path) _check_path(self.vmlinuz) _check_path(self.initramfs) def block_device(self): - if self.vid: + path = self.path + # create block device for modules.img only if: + # - there is kernel set for the VM + # - that kernel directory contains modules.img file + if path and os.path.exists(path): return super().block_device() return None diff --git a/qubes/tests/storage_kernels.py b/qubes/tests/storage_kernels.py index 7abcd0fa..9b067ef4 100644 --- a/qubes/tests/storage_kernels.py +++ b/qubes/tests/storage_kernels.py @@ -75,6 +75,8 @@ class TC_01_KernelVolumes(qubes.tests.QubesTestCase): self.app = TestApp() self.app.create_dummy_template() self.app.add_pool(**self.POOL_CONF) + os.makedirs(self.POOL_DIR + '/dummy', exist_ok=True) + open('/tmp/test-pool/dummy/modules.img', 'w').close() def tearDown(self): """ Remove the file based storage pool after testing """