vm: fix calling vm.detach_network() when really needed

*oldvalue* argument to property event handler is provided only when the
value was not default. Check vm.netvm directly to resolve also default.
This commit is contained in:
Marek Marczykowski-Górecki 2018-02-26 02:52:27 +01:00
parent 92a460526f
commit 173e7e4250
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -412,7 +412,8 @@ class NetVMMixin(qubes.events.Emitter):
'Cannot dynamically attach to stopped NetVM: {!r}'.format(
newvalue))
if oldvalue is not None:
# don't check oldvalue, because it's missing if it was default
if self.netvm is not None:
if self.is_running():
self.detach_network()