On 10/2/18 5:13 AM, Pavel Hrdina wrote:
On Mon, Oct 01, 2018 at 02:28:09PM -0400, Cole Robinson wrote:
On 09/28/2018 12:54 AM, Jim Fehlig wrote:
I've attempted to use virt-manager to create a new VM that uses a volume
from an rbd-based network pool, but have not been able to progress past
step 4/5 where VM storage is selected. It appears virt-manager has
problems properly detecting the volume as network-based storage, but
before investigating those further I have a question about the syntax of
the <target> element of a storage volume.
Yeah virt-manager is known to be lacking WRT rbd. I did some work a few
years back but didn't finish it. At least it doesn't know how to correctly
use a volume with any auth data in the XML. I need to get another rbd setup
to test with and fix it all
I was investigating the RBD support as well and in order to add proper
support for it into virt-manager we need to add support for secrets.
Right. But I was starting with the assumption that a "storage admin" setup an
rbd-based pool, necessary secrets, etc. Then user creating a new VM could select
existing volumes in the pool or create new ones at step 4/5 of the VM creation
wizard. Currently a user can select an existing volume or create a new one, but
can't progress beyond that point. I have a hack (attached, based against 1.5.1)
to workaround the problem in virt-manager. Commit 582c1d3d fixed virt-install to
copy auth data from the pool to the device config in domXML and as a first step
I'm trying to do the same with virt-manager.
Regards,
Jim
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 of 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.
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
@@ -246,6 +246,11 @@ class VirtualDisk(VirtualDevice):
if conn.is_remote() or not conn.is_qemu_system():
return None, []
+ # No need to check network volumes
+ if diskbackend.path_is_network_vol(conn, path):
+ logging.debug("bsc1100558: check_path_search: path %s is a network vol")
+ return None, []
+
from virtcli import CLIConfig
user = CLIConfig.default_qemu_user
try:
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,8 @@ def manage_path(conn, path):
if not path:
return None, None
- if not path_is_url(path):
+ if not path_is_network_vol(conn, path) and not path_is_url(path):
+ logging.debug("bsc1100558: manage_path: path %s is not a URL or a path to network volume, converting to abs 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 +189,25 @@ 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
+
+ logging.debug("bsc1100558: path_is_network_vol: path = %s", path)
+ vol, ignore = _lookup_vol_by_path(conn, path)
+ if vol:
+ voltype, ignore, ignore = vol.info()
+ if voltype == libvirt.VIR_STORAGE_VOL_NETWORK:
+ logging.debug("bsc1100558: path_is_network_vol: got vol of network type!")
+ return True
+
+ logging.debug("bsc1100558: path_is_network_vol: path is not a network volume!")
+ return False
+
+
def _get_dev_type(path, vol_xml, vol_object, pool_xml, remote):
"""
Try to get device type for volume.
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list