Don't check libvirt exception if libvirt is absent
Fixes-bug: #1572016 Change-Id: I62a5a085e2f49e8f086cc912406c94976d526687
This commit is contained in:
parent
9360743ccb
commit
c1ffbb4019
@ -92,11 +92,13 @@ def refresh_libvirt_connection(conf, klass):
|
|||||||
connection = getattr(klass, '_libvirt_connection', None)
|
connection = getattr(klass, '_libvirt_connection', None)
|
||||||
if not connection or not connection.isAlive():
|
if not connection or not connection.isAlive():
|
||||||
connection = new_libvirt_connection(conf)
|
connection = new_libvirt_connection(conf)
|
||||||
setattr(klass, '_libvirt_connection', connection)
|
setattr(klass, '_libvirt_connection', connection)
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
|
|
||||||
def is_disconnection_exception(e):
|
def is_disconnection_exception(e):
|
||||||
|
if not libvirt:
|
||||||
|
return False
|
||||||
return (isinstance(e, libvirt.libvirtError)
|
return (isinstance(e, libvirt.libvirtError)
|
||||||
and e.get_error_code() in (libvirt.VIR_ERR_SYSTEM_ERROR,
|
and e.get_error_code() in (libvirt.VIR_ERR_SYSTEM_ERROR,
|
||||||
libvirt.VIR_ERR_INTERNAL_ERROR)
|
libvirt.VIR_ERR_INTERNAL_ERROR)
|
||||||
|
Loading…
Reference in New Issue
Block a user