mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-09 08:58:27 +03:00
storagebrowser: ignore unparseable volumes
This e.g. happens when the volume was moved away but the pool didn't get refereshed: Traceback (most recent call last): File "/usr/share/virt-manager/virtManager/create.py", line 1229, in browse_import self._browse_file(set_path, is_media=False) File "/usr/share/virt-manager/virtManager/create.py", line 2118, in _browse_file self.storage_browser.show(self.topwin, self.conn) File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 74, in show self.reset_state(conn) File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 183, in reset_state self.pool_selected() File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 257, in pool_selected self.populate_storage_volumes() File "/usr/share/virt-manager/virtManager/storagebrowse.py", line 322, in populate_storage_volumes path = vol.get_target_path() File "/usr/share/virt-manager/virtManager/storagevol.py", line 49, in get_target_path return util.xpath(self.get_xml(), "/volume/target/path") File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 93, in get_xml self.refresh_xml() File "/usr/share/virt-manager/virtManager/libvirtobject.py", line 105, in refresh_xml self._xml = self._XMLDesc(self._active_xml_flags) File "/usr/share/virt-manager/virtManager/storagevol.py", line 35, in _XMLDesc return self.vol.XMLDesc(flags) File "/usr/lib/python2.7/dist-packages/libvirt.py", line 2002, in XMLDesc if ret is None: raise libvirtError ('virStorageVolGetXMLDesc() failed', vol=self) libvirt.libvirtError: cannot stat file '/var/scratch/vms/squeeze-template.img': No such file or directory Instead of failing the whole pool simply ignore the one failing volume. Without this patch selecting "Browse..." when creating a new vm from an existing disk image won't show the volume dialog if the default pool has a missing volume.
This commit is contained in:
parent
a7a0e316cf
commit
5e77012c76
@ -320,8 +320,13 @@ class vmmStorageBrowser(vmmGObjectUI):
|
|||||||
for key in vols.keys():
|
for key in vols.keys():
|
||||||
vol = vols[key]
|
vol = vols[key]
|
||||||
sensitive = True
|
sensitive = True
|
||||||
path = vol.get_target_path()
|
try:
|
||||||
fmt = vol.get_format() or ""
|
path = vol.get_target_path()
|
||||||
|
fmt = vol.get_format() or ""
|
||||||
|
except Exception:
|
||||||
|
logging.exception("Failed to determine volume parameters, "
|
||||||
|
"skipping volume %s" % key)
|
||||||
|
continue
|
||||||
namestr = None
|
namestr = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user