[Kimchi-devel] [PATCH] [Kimchi] Improve storage volume creation of XML

pvital at linux.vnet.ibm.com pvital at linux.vnet.ibm.com
Thu Sep 29 12:42:12 UTC 2016


From: Paulo Vital <pvital at linux.vnet.ibm.com>

Set the allocation in new storage volume XML to be zero if not creating
volume in logical pool, otherwise, use the capacity value of volume.

This is an improvement of issue #1017 solution.

Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
---
 model/storagevolumes.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/model/storagevolumes.py b/model/storagevolumes.py
index dfd2a19..c006b44 100644
--- a/model/storagevolumes.py
+++ b/model/storagevolumes.py
@@ -122,6 +122,7 @@ class StorageVolumesModel(object):
             raise InvalidParameter('KCHVOL0001E', {'name': name})
 
         params['pool'] = pool_name
+        params['pool_type'] = pool_info['type']
         targeturi = '/plugins/kimchi/storagepools/%s/storagevolumes/%s' \
                     % (pool_name, name)
         taskid = AsyncTask(targeturi, create_func, params).id
@@ -141,7 +142,10 @@ class StorageVolumesModel(object):
           </target>
         </volume>
         """
-        params.setdefault('allocation', params['capacity'])
+        allocation = 0
+        if params['pool_type'] == "logical":
+            allocation = params['capacity']
+        params.setdefault('allocation', allocation)
         params.setdefault('format', 'qcow2')
 
         name = params['name']
-- 
2.7.4




More information about the Kimchi-devel mailing list