- Fix selection of network volumes (bsc#1100558)

5a7698c7-fix-select-network-vol.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=433
This commit is contained in:
James Fehlig 2018-10-16 02:33:12 +00:00 committed by Git OBS Bridge
parent 70473cbdd6
commit 476fb9a620
7 changed files with 91 additions and 18 deletions

View File

@ -0,0 +1,65 @@
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

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Oct 16 02:24:29 UTC 2018 - James Fehlig <jfehlig@suse.com>
- Fix selection of network volumes (bsc#1100558)
5a7698c7-fix-select-network-vol.patch
-------------------------------------------------------------------
Fri Jul 13 16:03:17 MDT 2018 - carnold@suse.com

View File

@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -41,6 +41,7 @@ Source3: virt-manager-supportconfig
Patch1: 27d4b167-virtinst-update-location-for-opensuse.patch
Patch2: d15b78ab-virtinst-read-CPU-model-from-domain-capabilities.patch
Patch3: fd6a8154-virtinst-compare-host-and-domain-cpu-models.patch
Patch4: 5a7698c7-fix-select-network-vol.patch
# SUSE Only
Patch70: virtman-desktop.patch
Patch71: virtman-kvm.patch
@ -186,6 +187,7 @@ machine).
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
# SUSE Only
%patch70 -p1
%patch71 -p1

View File

@ -325,7 +325,7 @@ Index: virt-manager-1.5.1/virtinst/devicedisk.py
class _Host(XMLBuilder):
@@ -453,7 +453,7 @@ class VirtualDisk(VirtualDevice):
@@ -455,7 +455,7 @@ class VirtualDisk(VirtualDevice):
digit = 1
seen_valid = True
@ -334,7 +334,7 @@ Index: virt-manager-1.5.1/virtinst/devicedisk.py
return gen_t
@@ -1054,11 +1054,11 @@ class VirtualDisk(VirtualDevice):
@@ -1056,11 +1056,11 @@ class VirtualDisk(VirtualDevice):
def get_target():
first_found = None
@ -554,7 +554,7 @@ 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
@@ -391,7 +391,7 @@ class CloneStorageCreator(_StorageCreato
@@ -404,7 +404,7 @@ class CloneStorageCreator(_StorageCreato
else:
vfs = os.statvfs(os.path.dirname(self._path))
avail = vfs.f_frsize * vfs.f_bavail
@ -563,7 +563,7 @@ Index: virt-manager-1.5.1/virtinst/diskbackend.py
if need > avail:
if self._sparse:
msg = _("The filesystem will not have enough free space"
@@ -411,7 +411,7 @@ class CloneStorageCreator(_StorageCreato
@@ -424,7 +424,7 @@ class CloneStorageCreator(_StorageCreato
text = (_("Cloning %(srcfile)s") %
{'srcfile': os.path.basename(self._input_path)})

View File

@ -2,11 +2,11 @@ References: bsc#989639
When the device added is a cdrom device (/dev/sr0), don't use
"phy" as the driver name but instead use "qemu".
Index: virt-manager-1.5.0/virtinst/devicedisk.py
Index: virt-manager-1.5.1/virtinst/devicedisk.py
===================================================================
--- virt-manager-1.5.0.orig/virtinst/devicedisk.py
+++ virt-manager-1.5.0/virtinst/devicedisk.py
@@ -561,7 +561,8 @@ class VirtualDisk(VirtualDevice):
--- virt-manager-1.5.1.orig/virtinst/devicedisk.py
+++ virt-manager-1.5.1/virtinst/devicedisk.py
@@ -563,7 +563,8 @@ class VirtualDisk(VirtualDevice):
# Recommended xen defaults from here:
# https://bugzilla.redhat.com/show_bug.cgi?id=1171550#c9
# If type block, use name=phy. Otherwise do the same as qemu

View File

@ -2,11 +2,11 @@ Reference: bnc#813082
Virt-manager on Xen doesn't fill in any type thereby defaulting to
'raw'. This patch will generate the correct XML on Xen.
Index: virt-manager-1.5.0/virtinst/devicedisk.py
Index: virt-manager-1.5.1/virtinst/devicedisk.py
===================================================================
--- virt-manager-1.5.0.orig/virtinst/devicedisk.py
+++ virt-manager-1.5.0/virtinst/devicedisk.py
@@ -579,6 +579,10 @@ class VirtualDisk(VirtualDevice):
--- virt-manager-1.5.1.orig/virtinst/devicedisk.py
+++ virt-manager-1.5.1/virtinst/devicedisk.py
@@ -581,6 +581,10 @@ class VirtualDisk(VirtualDevice):
http://lists.gnu.org/archive/html/qemu-devel/2008-04/msg00675.html
"""
if self.driver_name != self.DRIVER_NAME_QEMU:

View File

@ -6,11 +6,11 @@ types (ide vs xen) it added xvda with hda. These disks were then
passed to qemu where it error'ed out with the disks having the same
index (in this case both are 0).
Index: virt-manager-1.5.0/virtinst/devicedisk.py
Index: virt-manager-1.5.1/virtinst/devicedisk.py
===================================================================
--- virt-manager-1.5.0.orig/virtinst/devicedisk.py
+++ virt-manager-1.5.0/virtinst/devicedisk.py
@@ -1036,6 +1036,17 @@ class VirtualDisk(VirtualDevice):
--- virt-manager-1.5.1.orig/virtinst/devicedisk.py
+++ virt-manager-1.5.1/virtinst/devicedisk.py
@@ -1038,6 +1038,17 @@ class VirtualDisk(VirtualDevice):
@rtype C{str}
"""
prefix, maxnode = self.get_target_prefix(skip_targets)
@ -28,7 +28,7 @@ Index: virt-manager-1.5.0/virtinst/devicedisk.py
skip_targets = [t for t in skip_targets if t and t.startswith(prefix)]
skip_targets.sort()
@@ -1049,7 +1060,12 @@ class VirtualDisk(VirtualDevice):
@@ -1051,7 +1062,12 @@ class VirtualDisk(VirtualDevice):
ran = range(pref_ctrl * 7, (pref_ctrl + 1) * 7)
for i in ran: