diff --git a/qubes/app.py b/qubes/app.py index 19021663..bdc2c904 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -1250,11 +1250,14 @@ class Qubes(qubes.PropertyHolder): oldvalue=None): # pylint: disable=unused-argument,invalid-name for vm in self.domains: - if not vm.provides_network and vm.property_is_default('netvm'): + if hasattr(vm, 'provides_network') and vm.provides_network and \ + hasattr(vm, 'netvm') and vm.property_is_default('netvm'): # fire property-del:netvm as it is responsible for resetting # netvm to it's default value + vm.fire_event('property-pre-del:netvm', pre_event=True, + name='netvm', oldvalue=oldvalue) vm.fire_event('property-del:netvm', - name='netvm', newvalue=newvalue, oldvalue=oldvalue) + name='netvm', oldvalue=oldvalue) @qubes.events.handler('property-set:default_netvm') @@ -1262,8 +1265,11 @@ class Qubes(qubes.PropertyHolder): oldvalue=None): # pylint: disable=unused-argument for vm in self.domains: - if hasattr(vm, 'netvm') and vm.property_is_default('netvm'): + if hasattr(vm, 'provides_network') and not vm.provides_network and \ + hasattr(vm, 'netvm') and vm.property_is_default('netvm'): # fire property-del:netvm as it is responsible for resetting # netvm to it's default value + vm.fire_event('property-pre-del:netvm', pre_event=True, + name='netvm', oldvalue=oldvalue) vm.fire_event('property-del:netvm', name='netvm', oldvalue=oldvalue)