From 148d1cda783b3c63dfd3547f3b2f15cd25d64025 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sat, 8 Jul 2017 02:36:39 +0200 Subject: [PATCH] vm/dispvm: fix DispVM storage definition Specify empty 'source' field, so it gets filled with appropriate template's images. Then also fix recursive 'source' handling - DispVM root volume should point at TemplateVM's root volume as a source, not a AppVM's one - which is also only a snapshot. Fixes QubesOS/qubes-issues#2896 --- qubes/storage/__init__.py | 6 +++++- qubes/vm/dispvm.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qubes/storage/__init__.py b/qubes/storage/__init__.py index 63ce351b..92cfb634 100644 --- a/qubes/storage/__init__.py +++ b/qubes/storage/__init__.py @@ -351,7 +351,7 @@ class Storage(object): for name, conf in self.vm.volume_config.items(): if 'source' in conf: template = getattr(vm, 'template', None) - if template: + while template: # we have no control over VM load order, # so initialize storage recursively if needed if template.storage is None: @@ -360,6 +360,10 @@ class Storage(object): # maybe we don't need it at all if it's always from # VM's template? conf['source'] = template.volumes[name] + if conf['source'].source is not None: + template = getattr(template, 'template', None) + else: + break self.init_volume(name, conf) diff --git a/qubes/vm/dispvm.py b/qubes/vm/dispvm.py index 97d67d49..55b2f48c 100644 --- a/qubes/vm/dispvm.py +++ b/qubes/vm/dispvm.py @@ -47,6 +47,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM): 'snap_on_start': True, 'save_on_stop': False, 'rw': False, + 'source': None, }, 'private': { 'name': 'private', @@ -54,6 +55,7 @@ class DispVM(qubes.vm.qubesvm.QubesVM): 'snap_on_start': True, 'save_on_stop': False, 'rw': True, + 'source': None, }, 'volatile': { 'name': 'volatile',