libvirt: fix missing python-libvirt issue

When python-libvirt is missing we must not use libvirt module exception
and just reraise error as-is.

Change-Id: If000dafdf9b7b08e108f6f91ae6ec967923eeb1d
Closes-bug: #1572016
This commit is contained in:
Mehdi Abaakouk 2016-04-19 10:00:12 +02:00
parent bdb291739a
commit 7d455d536f
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,9 @@ def retry_on_disconnect(function):
def decorator(self, *args, **kwargs):
try:
return function(self, *args, **kwargs)
except ImportError:
# NOTE(sileht): in case of libvirt failed to be imported
raise
except libvirt.libvirtError as e:
if (e.get_error_code() in (libvirt.VIR_ERR_SYSTEM_ERROR,
libvirt.VIR_ERR_INTERNAL_ERROR) and