From 3b407eb79ee2780eca2ac065d6e94c0f7c08c9a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 20 May 2016 02:52:57 +0200 Subject: [PATCH] qubes/app: do not enable domain events when loading XML Event should be enabled only after all the domains are loaded (and domain-load event if fired). QubesOS/qubes-issues#1816 --- qubes/app.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/qubes/app.py b/qubes/app.py index be072896..c0557751 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -382,7 +382,7 @@ class VMCollection(object): values = vms - def add(self, value): + def add(self, value, _enable_events=True): '''Add VM to collection :param qubes.vm.BaseVM value: VM to add @@ -404,8 +404,9 @@ class VMCollection(object): 'name={!r} ({!r})'.format(value.name, self[value.name])) self._dict[value.qid] = value - value.events_enabled = True - self.app.fire_event('domain-add', value) + if _enable_events: + value.events_enabled = True + self.app.fire_event('domain-add', value) return value @@ -659,11 +660,12 @@ class Qubes(qubes.PropertyHolder): vm = cls(self, node) vm.load_properties(load_stage=2) vm.init_log() - self.domains.add(vm) + self.domains.add(vm, _enable_events=False) if 0 not in self.domains: - self.domains.add(qubes.vm.adminvm.AdminVM( - self, None, qid=0, name='dom0')) + self.domains.add( + qubes.vm.adminvm.AdminVM(self, None, qid=0, name='dom0'), + _enable_events=False) # stage 3: load global properties self.load_properties(load_stage=3)