mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 21:18:04 +03:00
virtManager: clone: build default clone path if we know how
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 Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
f6a6c58a36
commit
a02fc0d022
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user