storage/kernels: support only save_on_stop=False volumes

LinuxKernel pool support only read-only volumes, so save_on_stop=True
doesn't make sense. Make it more explicit - raise NotImplementedError
otherwise.
Also, migrate old configs where snap_on_start=True, but no source was
given.

QubesOS/qubes-issues#2256
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-03 23:39:13 +02:00
parent 0e554296e3
commit c7ca4a445e
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -138,6 +138,14 @@ class LinuxKernel(Pool):
def init_volume(self, vm, volume_config):
assert not volume_config['rw']
# migrate old config
if volume_config.get('snap_on_start', False) and not \
volume_config.get('source', None):
volume_config['snap_on_start'] = False
if volume_config.get('save_on_stop', False):
raise NotImplementedError(
'LinuxKernel pool does not support save_on_stop=True')
volume_config['pool'] = self
volume = LinuxModules(self.dir_path, lambda: vm.kernel, **volume_config)