app: drop reference to libvirt object after undefining it

Do not try to access that particular object (wrapper) when it got
undefined. If anyone want to access it, appropriate code should do a new
lookup, and probably re-define the object.
This commit is contained in:
Marek Marczykowski-Górecki 2017-11-06 01:23:14 +01:00
parent b5e07238a0
commit 227378f2b3
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -484,6 +484,8 @@ class VMCollection(object):
self.app.fire_event('domain-pre-delete', pre_event=True, vm=vm)
try:
vm.libvirt_domain.undefine()
# pylint: disable=protected-access
vm._libvirt_domain = None
except libvirt.libvirtError as e:
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
# already undefined