mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
diskbackend: Try looking up network volumes by path
For gluster volumes, which have unique URLs for volume paths, this makes selecting network volumes via the storagebrowser UI work. Sheepdog and RBD volumes don't work yet
This commit is contained in:
parent
2890d70a79
commit
12340a3858
@ -524,13 +524,9 @@ class VirtualDisk(VirtualDevice):
|
||||
raise ValueError("Can't change disk path if storage creation info "
|
||||
"has been set.")
|
||||
|
||||
parent_pool = None
|
||||
vol_object = None
|
||||
if newpath:
|
||||
# User explicitly changed 'path', so try to lookup its storage
|
||||
# object since we may need it
|
||||
(vol_object, parent_pool) = diskbackend.manage_path(
|
||||
self.conn, newpath)
|
||||
# User explicitly changed 'path', so try to lookup its storage
|
||||
# object since we may need it
|
||||
(vol_object, parent_pool) = diskbackend.manage_path(self.conn, newpath)
|
||||
|
||||
self._change_backend(newpath, vol_object, parent_pool)
|
||||
self._set_xmlpath(self.path)
|
||||
|
@ -114,6 +114,9 @@ def _can_auto_manage(path):
|
||||
path = path or ""
|
||||
skip_prefixes = ["/dev", "/sys", "/proc"]
|
||||
|
||||
if path_is_url(path):
|
||||
return False
|
||||
|
||||
for prefix in skip_prefixes:
|
||||
if path.startswith(prefix + "/") or path == prefix:
|
||||
return False
|
||||
@ -126,10 +129,11 @@ def manage_path(conn, path):
|
||||
"""
|
||||
if not conn.check_support(conn.SUPPORT_CONN_STORAGE):
|
||||
return None, None
|
||||
if path_is_url(path):
|
||||
if not path:
|
||||
return None, None
|
||||
|
||||
path = os.path.abspath(path)
|
||||
if not path_is_url(path):
|
||||
path = os.path.abspath(path)
|
||||
vol, pool = check_if_path_managed(conn, path)
|
||||
if vol or pool or not _can_auto_manage(path):
|
||||
return vol, pool
|
||||
|
Loading…
Reference in New Issue
Block a user