storage: do not use deepcopy on volume configs
There may be Pool or Volume object references, which is intentional to keep them as is - not copy whole Pool/Volume objects.
This commit is contained in:
parent
e6d5337fa7
commit
f2f89c7b0c
@ -349,6 +349,7 @@ class Storage(object):
|
||||
|
||||
if hasattr(vm, 'volume_config'):
|
||||
for name, conf in self.vm.volume_config.items():
|
||||
conf = conf.copy()
|
||||
if 'source' in conf:
|
||||
template = getattr(vm, 'template', None)
|
||||
if template:
|
||||
|
@ -93,7 +93,7 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
|
||||
# in case the template vm has more volumes add them to own
|
||||
# config
|
||||
if name not in self.volume_config:
|
||||
self.volume_config[name] = copy.deepcopy(config)
|
||||
self.volume_config[name] = config.copy()
|
||||
if 'vid' in self.volume_config[name]:
|
||||
del self.volume_config[name]['vid']
|
||||
|
||||
@ -123,7 +123,7 @@ class AppVM(qubes.vm.qubesvm.QubesVM):
|
||||
for volume_name, conf in self.default_volume_config.items():
|
||||
if conf.get('snap_on_start', False) and \
|
||||
conf.get('source', None) is None:
|
||||
config = copy.deepcopy(conf)
|
||||
config = conf.copy()
|
||||
template_volume = newvalue.volumes[volume_name]
|
||||
self.volume_config[volume_name] = \
|
||||
self.config_volume_from_source(
|
||||
|
@ -21,8 +21,6 @@
|
||||
|
||||
''' A disposable vm implementation '''
|
||||
|
||||
import copy
|
||||
|
||||
import qubes.vm.qubesvm
|
||||
import qubes.vm.appvm
|
||||
import qubes.config
|
||||
@ -89,7 +87,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
|
||||
# in case the template vm has more volumes add them to own
|
||||
# config
|
||||
if name not in self.volume_config:
|
||||
self.volume_config[name] = copy.deepcopy(config)
|
||||
self.volume_config[name] = config.copy()
|
||||
if 'vid' in self.volume_config[name]:
|
||||
del self.volume_config[name]['vid']
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import asyncio
|
||||
import copy
|
||||
import base64
|
||||
import datetime
|
||||
import os
|
||||
@ -1799,8 +1798,7 @@ def _clean_volume_config(config):
|
||||
common_attributes = ['name', 'pool', 'size',
|
||||
'revisions_to_keep', 'rw', 'snap_on_start',
|
||||
'save_on_stop', 'source']
|
||||
config_copy = copy.deepcopy(config)
|
||||
return {k: v for k, v in config_copy.items() if k in common_attributes}
|
||||
return {k: v for k, v in config.items() if k in common_attributes}
|
||||
|
||||
|
||||
def _patch_pool_config(config, pool=None, pools=None):
|
||||
|
Loading…
Reference in New Issue
Block a user