[Kimchi-devel] [PATCH] vmtemplate: allow allocation = 0 for type 'raw'

Daniel Henrique Barboza danielhb at linux.vnet.ibm.com
Tue Nov 25 12:15:34 UTC 2014


Kimchi was allocating the entire disk when the disk image type wasn't
'qcow2'. Adding 'raw' to this exception list because raw images can
be created as sparse (= size in bytes when creating the disk is
less than its total capacity) too.

Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
---
 src/kimchi/vmtemplate.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/vmtemplate.py b/src/kimchi/vmtemplate.py
index 5dbbdd4..6c449f2 100644
--- a/src/kimchi/vmtemplate.py
+++ b/src/kimchi/vmtemplate.py
@@ -197,7 +197,8 @@ class VMTemplate(object):
                     'capacity': d['size'],
                     'format': fmt,
                     'path': '%s/%s' % (storage_path, volume)}
-            info['allocation'] = 0 if fmt == 'qcow2' else info['capacity']
+            info['allocation'] = 0 if fmt in ['qcow2', 'raw'] \
+                else info['capacity']
 
             if 'base' in d:
                 info['base'] = dict()
-- 
1.9.3




More information about the Kimchi-devel mailing list