Prechádzať zdrojové kódy

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
Marek Marczykowski-Górecki 7 rokov pred
rodič
commit
c7ca4a445e
1 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 8 0
      qubes/storage/kernels.py

+ 8 - 0
qubes/storage/kernels.py

@@ -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)