diff --git a/qubes/storage/__init__.py b/qubes/storage/__init__.py index 5cd647be..26598f85 100644 --- a/qubes/storage/__init__.py +++ b/qubes/storage/__init__.py @@ -262,29 +262,21 @@ class Volume(object): @property def config(self): ''' return config data for serialization to qubes.xml ''' - result = {'name': self.name, 'pool': str(self.pool), 'vid': self.vid, } - - if self.internal: - result['internal'] = self.internal - - if self.removable: - result['removable'] = self.removable - - if self.revisions_to_keep: - result['revisions_to_keep'] = self.revisions_to_keep - - if self.rw: - result['rw'] = self.rw - - if self.save_on_stop: - result['save_on_stop'] = self.save_on_stop + result = { + 'name': self.name, + 'pool': str(self.pool), + 'vid': self.vid, + 'internal': self.internal, + 'removable': self.removable, + 'revisions_to_keep': self.revisions_to_keep, + 'rw': self.rw, + 'save_on_stop': self.save_on_stop, + 'snap_on_start': self.snap_on_start, + } if self.size: result['size'] = self.size - if self.snap_on_start: - result['snap_on_start'] = self.snap_on_start - if self.source: result['source'] = str(self.source) diff --git a/qubes/vm/appvm.py b/qubes/vm/appvm.py index 74ddc28e..b818c995 100644 --- a/qubes/vm/appvm.py +++ b/qubes/vm/appvm.py @@ -63,6 +63,8 @@ class AppVM(qubes.vm.qubesvm.QubesVM): 'volatile': { 'name': 'volatile', 'pool': 'default', + 'snap_on_start': False, + 'save_on_stop': False, 'size': defaults['root_img_size'], 'internal': True, 'rw': True, @@ -70,6 +72,8 @@ class AppVM(qubes.vm.qubesvm.QubesVM): 'kernel': { 'name': 'kernel', 'pool': 'linux-kernel', + 'snap_on_start': False, + 'save_on_stop': False, 'rw': False, 'internal': True } diff --git a/qubes/vm/dispvm.py b/qubes/vm/dispvm.py index ff8e39d5..8586627b 100644 --- a/qubes/vm/dispvm.py +++ b/qubes/vm/dispvm.py @@ -61,6 +61,8 @@ class DispVM(qubes.vm.qubesvm.QubesVM): 'name': 'volatile', 'pool': 'default', 'internal': True, + 'snap_on_start': False, + 'save_on_stop': False, 'rw': True, 'size': qubes.config.defaults['root_img_size'] + qubes.config.defaults['private_img_size'], @@ -68,6 +70,8 @@ class DispVM(qubes.vm.qubesvm.QubesVM): 'kernel': { 'name': 'kernel', 'pool': 'linux-kernel', + 'snap_on_start': False, + 'save_on_stop': False, 'rw': False, 'internal': True } diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index a96288dd..2c0ea441 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -1824,20 +1824,17 @@ def _clean_volume_config(config): def _patch_pool_config(config, pool=None, pools=None): assert pool is not None or pools is not None - is_saveable = 'save_on_stop' in config and config['save_on_stop'] - is_resetable = not ('snap_on_start' in config and # volatile - config['snap_on_start'] and not is_saveable) - - is_exportable = is_saveable or is_resetable + is_snapshot = config['snap_on_start'] + is_rw = config['rw'] name = config['name'] - if pool and is_exportable and config['pool'] == 'default': + if pool and not is_snapshot and is_rw: config['pool'] = str(pool) - elif pool and not is_exportable: + elif pool: pass elif pools and name in pools.keys(): - if is_exportable: + if not is_snapshot: config['pool'] = str(pools[name]) else: msg = "Can't clone a snapshot volume {!s} to pool {!s} " \ diff --git a/qubes/vm/standalonevm.py b/qubes/vm/standalonevm.py index ef3b59d1..7aab434d 100644 --- a/qubes/vm/standalonevm.py +++ b/qubes/vm/standalonevm.py @@ -51,6 +51,8 @@ class StandaloneVM(qubes.vm.qubesvm.QubesVM): 'volatile': { 'name': 'volatile', 'pool': 'default', + 'snap_on_start': False, + 'save_on_stop': False, 'internal': True, 'rw': True, 'size': qubes.config.defaults['root_img_size'], @@ -58,6 +60,8 @@ class StandaloneVM(qubes.vm.qubesvm.QubesVM): 'kernel': { 'name': 'kernel', 'pool': 'linux-kernel', + 'snap_on_start': False, + 'save_on_stop': False, 'rw': False, 'internal': True } diff --git a/qubes/vm/templatevm.py b/qubes/vm/templatevm.py index 7be3e0a2..8cd07528 100644 --- a/qubes/vm/templatevm.py +++ b/qubes/vm/templatevm.py @@ -88,12 +88,16 @@ class TemplateVM(QubesVM): 'name': 'volatile', 'pool': 'default', 'size': defaults['root_img_size'], + 'snap_on_start': False, + 'save_on_stop': False, 'internal': True, 'rw': True, }, 'kernel': { 'name': 'kernel', 'pool': 'linux-kernel', + 'snap_on_start': False, + 'save_on_stop': False, 'internal': True, 'rw': False }