diff --git a/qubes/__init__.py b/qubes/__init__.py index 73a0ba14..c580efd5 100644 --- a/qubes/__init__.py +++ b/qubes/__init__.py @@ -125,7 +125,6 @@ class VMMConnection(object): if self._libvirt_conn is None: raise qubes.exc.QubesException('Failed connect to libvirt driver') libvirt.registerErrorHandler(self._libvirt_error_handler, None) - atexit.register(self._libvirt_conn.close) @__builtin__.property def libvirt_conn(self): @@ -165,6 +164,10 @@ class VMMConnection(object): self.init_vmm_connection() return self._xs + def __del__(self): + if self._libvirt_conn: + self._libvirt_conn.close() + class QubesHost(object): '''Basic information about host machine