storage/kernel: skip modules.img block device if kernel dir doesn't have it
Some kernels (like pvgrub2) may not provide modules.img and it isn't an error. Don't break VM startup in that case, skip that device instead. Fixes QubesOS/qubes-issues#3563
This commit is contained in:
parent
ba5d19e1b4
commit
1774be1c69
@ -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
|
||||
|
||||
|
@ -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 """
|
||||
|
Loading…
Reference in New Issue
Block a user