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
This commit is contained in:
Marek Marczykowski-Górecki 2016-05-20 02:52:57 +02:00 committed by Wojtek Porczyk
parent 90928dc4a0
commit 3b407eb79e

View File

@ -382,7 +382,7 @@ class VMCollection(object):
values = vms values = vms
def add(self, value): def add(self, value, _enable_events=True):
'''Add VM to collection '''Add VM to collection
:param qubes.vm.BaseVM value: VM to add :param qubes.vm.BaseVM value: VM to add
@ -404,8 +404,9 @@ class VMCollection(object):
'name={!r} ({!r})'.format(value.name, self[value.name])) 'name={!r} ({!r})'.format(value.name, self[value.name]))
self._dict[value.qid] = value self._dict[value.qid] = value
value.events_enabled = True if _enable_events:
self.app.fire_event('domain-add', value) value.events_enabled = True
self.app.fire_event('domain-add', value)
return value return value
@ -659,11 +660,12 @@ class Qubes(qubes.PropertyHolder):
vm = cls(self, node) vm = cls(self, node)
vm.load_properties(load_stage=2) vm.load_properties(load_stage=2)
vm.init_log() vm.init_log()
self.domains.add(vm) self.domains.add(vm, _enable_events=False)
if 0 not in self.domains: if 0 not in self.domains:
self.domains.add(qubes.vm.adminvm.AdminVM( self.domains.add(
self, None, qid=0, name='dom0')) qubes.vm.adminvm.AdminVM(self, None, qid=0, name='dom0'),
_enable_events=False)
# stage 3: load global properties # stage 3: load global properties
self.load_properties(load_stage=3) self.load_properties(load_stage=3)