From 94c675f7bb77f5e2a67bc11fbcb492c3ffe4fda0 Mon Sep 17 00:00:00 2001 From: Malte Leip Date: Sun, 2 Jun 2019 17:58:19 +0200 Subject: [PATCH] DispVM: Do not overwrite properties set explicitly The initializer of the class DispVM first calls the initializer of the QubesVM class, which among other things sets properties as specified in kwargs, and then copies over the properties of the template. This can lead to properties passed explicitly by the caller through kwargs being overwritten. Hence only clone properties of the template that are still set to default in the DispVM. Fixes QubesOS/qubes-issues#4556 --- qubes/vm/dispvm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qubes/vm/dispvm.py b/qubes/vm/dispvm.py index d26079a2..da0214c0 100644 --- a/qubes/vm/dispvm.py +++ b/qubes/vm/dispvm.py @@ -116,7 +116,10 @@ class DispVM(qubes.vm.qubesvm.QubesVM): # by default inherit properties from the DispVM template proplist = [prop.__name__ for prop in template.property_list() if prop.clone and prop.__name__ not in ['template']] - self_props = [prop.__name__ for prop in self.property_list()] + # Do not overwrite properties that have already been set to a + # non-default value. + self_props = [prop.__name__ for prop in self.property_list() + if self.property_is_default(prop)] self.clone_properties(template, set(proplist).intersection( self_props))