cloner: Improve error message about unimplemented rbd support

Fixes: https://github.com/virt-manager/virt-manager/issues/340

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson
2022-01-26 16:39:47 -05:00
parent b7e86d2fcc
commit 1a1bbe99f8
2 changed files with 5 additions and 9 deletions

View File

@@ -1436,7 +1436,6 @@ c.add_invalid("--connect %(URI-TEST-FULL)s -o test-clone-simple -n newvm --file
c.add_invalid("--connect %(URI-TEST-REMOTE)s -o test-clone-simple --auto-clone --file /dev/default-pool/testvol9.img --check all=off", grep="Clone onto existing storage volume") # hit a specific error message
c.add_invalid("--connect %(URI-TEST-FULL)s -o test-clone-full --auto-clone", grep="not enough free space") # catch failure of clone path setting
c.add_invalid(_CLONE_NET_HTTP + " --auto-clone", grep="'http' is not cloneable")
c.add_invalid(_CLONE_NET_RBD + " --auto-clone", grep="'rbd' requires managed storage") # connection doesn't have the referenced rbd volume
c.add_invalid(_CLONE_NET_RBD + " --connect %(URI-TEST-FULL)s --auto-clone", grep="Cloning rbd volumes is not yet supported")

View File

@@ -177,17 +177,14 @@ def _get_cloneable_msg(disk):
if disk.type == "network":
proto = disk.source.protocol
if proto not in ["rbd"]:
return _("Disk network type '%s' is not cloneable.") % proto
disk.set_backend_for_existing_path()
if not disk.get_vol_object():
return _("Cloning disk network type '%s' requires "
"managed storage.") % proto
else:
if proto == "rbd":
# This case, rbd with managed storage, is implementable. It
# requires open coding a bunch of work in cloner, or reworking
# other disk code to add unique URIs for rbd volumes and pools
return _("Cloning rbd volumes is not yet supported.")
return (
_("Cloning rbd volumes is not yet supported.") +
" https://github.com/virt-manager/virt-manager/issues/177")
return _("Disk network type '%s' is not cloneable.") % proto
def _get_shareable_msg(disk):