Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit ce0afbf

Browse files
committed
VirtualDisk: Report error if GetVolByPath fails unexpectedly
1 parent 25167cc commit ce0afbf

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

virtinst/VirtualDisk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ def lookup_vol_by_path():
164164
vol = conn.storageVolLookupByPath(path)
165165
vol.info()
166166
return vol, None
167-
except Exception, e:
167+
except libvirt.libvirtError, e:
168+
if (hasattr(libvirt, "VIR_ERR_NO_STORAGE_VOL")
169+
and e.get_error_code() != libvirt.VIR_ERR_NO_STORAGE_VOL):
170+
raise
168171
return None, e
169172

170173
def lookup_vol_name(name):

0 commit comments

Comments
 (0)