Fix reconnecting to libvirt
The libvirt inspector may can't inspect data from libvirt on some occasions after libvirtd is restarted, though we have reconnecting logic. When this occurs, it will raise libvirt.VIR_ERR_INTERNAL_ERROR instead of libvirt.VIR_ERR_SYSTEM_ERROR in reconnecting logic. This results compute agent no longer reconnects to libvirt, and fails to inspect data any more. This patch is just updated to deal with INTERNAL_ERROR. Change-Id: Ifbd754cb050ec7e364d17fea3b32191da1e22ef5 Closes-bug: #1498013
This commit is contained in:
parent
1f342ef3e2
commit
7f290fcdb5
@ -48,7 +48,8 @@ def retry_on_disconnect(function):
|
||||
try:
|
||||
return function(self, *args, **kwargs)
|
||||
except libvirt.libvirtError as e:
|
||||
if (e.get_error_code() == libvirt.VIR_ERR_SYSTEM_ERROR and
|
||||
if (e.get_error_code() in (libvirt.VIR_ERR_SYSTEM_ERROR,
|
||||
libvirt.VIR_ERR_INTERNAL_ERROR) and
|
||||
e.get_error_domain() in (libvirt.VIR_FROM_REMOTE,
|
||||
libvirt.VIR_FROM_RPC)):
|
||||
LOG.debug('Connection to libvirt broken')
|
||||
@ -94,7 +95,8 @@ class LibvirtInspector(virt_inspector.Inspector):
|
||||
if not libvirt or not isinstance(ex, libvirt.libvirtError):
|
||||
raise virt_inspector.InspectorException(six.text_type(ex))
|
||||
error_code = ex.get_error_code()
|
||||
if (error_code == libvirt.VIR_ERR_SYSTEM_ERROR and
|
||||
if (error_code in (libvirt.VIR_ERR_SYSTEM_ERROR,
|
||||
libvirt.VIR_ERR_INTERNAL_ERROR) and
|
||||
ex.get_error_domain() in (libvirt.VIR_FROM_REMOTE,
|
||||
libvirt.VIR_FROM_RPC)):
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user