qubesvm: do not try to define libvirt object in offline mode

The idea is to not touch libvirt at all.
This commit is contained in:
Marek Marczykowski-Górecki 2018-01-17 15:23:39 +01:00
parent f2b9be3607
commit dce3b609b4
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 5 additions and 1 deletions

View File

@ -483,7 +483,8 @@ class VMCollection(object):
raise qubes.exc.QubesVMNotHaltedError(vm)
self.app.fire_event('domain-pre-delete', pre_event=True, vm=vm)
try:
vm.libvirt_domain.undefine()
if vm.libvirt_domain:
vm.libvirt_domain.undefine()
# pylint: disable=protected-access
vm._libvirt_domain = None
except libvirt.libvirtError as e:

View File

@ -570,6 +570,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
if self._libvirt_domain is not None:
return self._libvirt_domain
if self.app.vmm.offline_mode:
return None
# XXX _update_libvirt_domain?
try:
self._libvirt_domain = self.app.vmm.libvirt_conn.lookupByUUID(