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

Giuseppe Scrivano gscrivan at redhat.com
Fri Sep 20 16:42:03 UTC 2013


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,
-- 
1.8.3.1




More information about the virt-tools-list mailing list