From dce3b609b479fb979ebd77a59b186f74e2a4153a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Wed, 17 Jan 2018 15:23:39 +0100 Subject: [PATCH] qubesvm: do not try to define libvirt object in offline mode The idea is to not touch libvirt at all. --- qubes/app.py | 3 ++- qubes/vm/qubesvm.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qubes/app.py b/qubes/app.py index 06a1a41d..48561bd1 100644 --- a/qubes/app.py +++ b/qubes/app.py @@ -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: diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index dd66ab3a..493ef397 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -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(