[virt-tools-list] [virt-manager PATCH] virtManager: clone: check which storage pools supports volume cloning

Cole Robinson crobinso at redhat.com
Sun Mar 3 00:01:35 UTC 2019


On 3/1/19 6:18 AM, Pavel Hrdina wrote:
> When cloning a guest in virt-manager the GUI shows a list of disks and
> select default cloning policy for every disk.  For storage pools where
> we know that cloning is not possible we should not select that option
> as default one.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1463066
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  virtManager/clone.py       | 11 ++++++-----
>  virtManager/storagepool.py |  4 ++--
>  virtinst/storage.py        | 24 ++++++++++++++++++------
>  3 files changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/virtManager/clone.py b/virtManager/clone.py
> index 895d258a..cd991f6b 100644
> --- a/virtManager/clone.py
> +++ b/virtManager/clone.py
> @@ -64,6 +64,11 @@ def can_we_clone(conn, vol, path):
>          elif not os.path.exists(path):
>              msg = _("Path does not exist.")
>  
> +    else:
> +        pool = vol.get_parent_pool()
> +        if not pool.supports_volume_creation(clone=True):
> +            msg = _("Cannot clone {} storage pool.".format(pool.get_type()))
> +

Ugh I know this is what the python world is pushing these days but I
personally find that format to be ugly and far less readable. Please use
the traditional format for this patch. If you feel strongly about using
that format in the code base let's have a top level thread about it.

Otherwise:

Reviewed-by: Cole Robinson <crobinso at redhat.com>

Thanks,
Cole




More information about the virt-tools-list mailing list