[virt-tools-list] [virt-manager PATCH] virtManager: clone: build default clone path if we know how
Pavel Hrdina
phrdina at redhat.com
Tue Mar 5 11:18:12 UTC 2019
Function do_we_default returns only if we want to default to clone disk
even if we know how to create default clone path. Only in case that the
storage pool is TYPE_DISK we don't know how to create default path and
we cannot default to clone that disk. In all other cases as ReadOnly
disk or Shareable and so on we can prepare the default path for user if
they decide to clone it.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1565106
Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
virtManager/clone.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/virtManager/clone.py b/virtManager/clone.py
index 4148fca0..1adc59c9 100644
--- a/virtManager/clone.py
+++ b/virtManager/clone.py
@@ -79,6 +79,7 @@ def do_we_default(conn, vol, path, ro, shared, devtype):
""" Returns (do we clone by default?, info string if not)"""
ignore = conn
info = ""
+ can_default = True
def append_str(str1, str2, delim=", "):
if not str2:
@@ -101,11 +102,12 @@ def do_we_default(conn, vol, path, ro, shared, devtype):
pool_type = vol.get_parent_pool().get_type()
if pool_type == virtinst.StoragePool.TYPE_DISK:
info = append_str(info, _("Disk device"))
+ can_default = False
if shared:
info = append_str(info, _("Shareable"))
- return (not info, info)
+ return (not info, info, can_default)
class vmmCloneVM(vmmGObjectUI):
@@ -390,8 +392,8 @@ class vmmCloneVM(vmmGObjectUI):
skip_targets.remove(force_target)
vol = self.conn.get_vol_by_path(path)
- default, definfo = do_we_default(self.conn, vol, path, ro, shared,
- devtype)
+ default, definfo, can_default = do_we_default(self.conn, vol, path,
+ ro, shared, devtype)
def storage_add(failinfo=None):
# pylint: disable=cell-var-from-loop
@@ -426,7 +428,7 @@ class vmmCloneVM(vmmGObjectUI):
storage_row[STORAGE_INFO_CAN_CLONE] = True
# If we cannot create default clone_path don't even try to do that
- if not default:
+ if not can_default:
storage_add()
continue
--
2.20.1
More information about the virt-tools-list
mailing list