Fixed property-reset event not firing for default_dispvm global property

fixes QubesOS/qubes-issues#5977
This commit is contained in:
Marta Marczykowska-Górecka 2020-08-03 22:08:11 +02:00
parent 784878f1f7
commit f35a7a78b3
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B

View File

@ -1546,3 +1546,15 @@ class Qubes(qubes.PropertyHolder):
# netvm to it's default value
vm.fire_event('property-reset:netvm',
name='netvm', oldvalue=oldvalue)
@qubes.events.handler('property-set:default_dispvm')
def on_property_set_default_dispvm(self, event, name, newvalue,
oldvalue=None):
# pylint: disable=unused-argument
for vm in self.domains:
if hasattr(vm, 'default_dispvm') and \
vm.property_is_default('default_dispvm'):
# fire property-reset:default_dispvm as it is responsible for
# resetting dispvm to it's default value
vm.fire_event('property-reset:default_dispvm',
name='default_dispvm', oldvalue=oldvalue)