[virt-tools-list] [PATCH] virtinst: correctly check if "allocation" is None

Cole Robinson crobinso at redhat.com
Fri Sep 20 20:46:30 UTC 2013


On 09/20/2013 12:42 PM, Giuseppe Scrivano wrote:
> Just checking "allocation" instead of "allocation is not None"
> inhibits the warning message when "allocation == 0".
> 
> Related to bz 1000980.
> 
> Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
> ---
>  virtinst/storage.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virtinst/storage.py b/virtinst/storage.py
> index e0b0ef1..b2727ba 100644
> --- a/virtinst/storage.py
> +++ b/virtinst/storage.py
> @@ -1363,7 +1363,7 @@ class LogicalVolume(StorageVolume):
>      def __init__(self, conn,
>                   name, capacity, pool=None, pool_name=None,
>                   allocation=None, perms=None):
> -        if allocation and allocation != capacity:
> +        if allocation is not None and allocation != capacity:
>              logging.warn(_("Sparse logical volumes are not supported, "
>                             "setting allocation equal to capacity"))
>          StorageVolume.__init__(self, conn, name=name,
> 

Actually I think I inadvertently fixed this earlier today in the process of
gutting virtinst/storage.py to make it use XMLBuilder. Can you confirm its not
an issue with current git?

Thanks,
Cole




More information about the virt-tools-list mailing list