Move libvirt_conn.close to object destructor
Process exit is too late for long-running processes. Especially tests, which create a lot of such objects which leads to depleting all the file descriptors. QubesOS/qubes-issues#1697
This commit is contained in:
parent
ab469e4473
commit
929923164e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user