virt-manager/5a7698c7-fix-select-network-vol.patch

66 lines
2.3 KiB
Diff

commit 5a7698c7998d673e0742046478630824162966b4
Author: Jim Fehlig <jfehlig@suse.com>
Date: Tue Oct 9 14:30:09 2018 -0600
Fix selection of network volumes
When creating a new VM and selecting a volume from a network-based
storage pool such as rbd, the volume is not recognized as network-based
and is treated as a volume from a directory storage pool.
This patch adds a method to check if the volume's path points to a
network-based volume, then uses the method to avoid actions like
setting unix file permissions on the volume, which doesn't make
sense for a network-based volume.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(crobinso: rebase, tweak lookup logic)
Index: virt-manager-1.5.1/virtinst/diskbackend.py
===================================================================
--- virt-manager-1.5.1.orig/virtinst/diskbackend.py
+++ virt-manager-1.5.1/virtinst/diskbackend.py
@@ -156,7 +156,7 @@ def manage_path(conn, path):
if not path:
return None, None
- if not path_is_url(path):
+ if not path_is_url(path) and not path_is_network_vol(conn, path):
path = os.path.abspath(path)
vol, pool = check_if_path_managed(conn, path)
if vol or pool or not _can_auto_manage(path):
@@ -188,6 +188,19 @@ def path_is_url(path):
return bool(re.match("[a-zA-Z]+(\+[a-zA-Z]+)?://.*", path))
+def path_is_network_vol(conn, path):
+ """
+ Detect if path is a network volume such as rbd, gluster, etc
+ """
+ if not path:
+ return False
+
+ for volxml in conn.fetch_all_vols():
+ if volxml.target_path == path:
+ return volxml.type == "network"
+ return False
+
+
def _get_dev_type(path, vol_xml, vol_object, pool_xml, remote):
"""
Try to get device type for volume.
Index: virt-manager-1.5.1/virtinst/devicedisk.py
===================================================================
--- virt-manager-1.5.1.orig/virtinst/devicedisk.py
+++ virt-manager-1.5.1/virtinst/devicedisk.py
@@ -216,6 +216,8 @@ class VirtualDisk(VirtualDevice):
return []
if diskbackend.path_is_url(path):
return []
+ if diskbackend.path_is_network_vol(conn, path):
+ return []
try:
# Get UID for string name