summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2019-07-01 18:53:16 -0400
committerCole Robinson <crobinso@redhat.com>2019-07-01 18:53:16 -0400
commit6a1b0254bf667f82453e496f17535134d06e7700 (patch)
treeb5ce99b59086259ab1f4dd00425591e761fae3dc
parent2df7a6bab478ffc63b187a3990a2f39fb072b01d (diff)
downloadvirt-manager-6a1b0254bf667f82453e496f17535134d06e7700.tar.gz
diskbackend: Handle unexpected error from test_urls
-rw-r--r--virtinst/diskbackend.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/virtinst/diskbackend.py b/virtinst/diskbackend.py
index fa3f3a0f..65ef52b0 100644
--- a/virtinst/diskbackend.py
+++ b/virtinst/diskbackend.py
@@ -27,7 +27,12 @@ def _lookup_vol_by_path(conn, path):
vol.info()
return vol, None
except libvirt.libvirtError as e:
- if (hasattr(libvirt, "VIR_ERR_NO_STORAGE_VOL") and
+ # test_urls trigger empty errors here, because python
+ # garbage collection kicks in after the failure but before
+ # we read the error code, and libvirt virStoragePoolFree
+ # public entry point clears the cached error. So ignore
+ # an empty error code
+ if (e.get_error_code() and
e.get_error_code() != libvirt.VIR_ERR_NO_STORAGE_VOL):
raise
return None, e