[Kimchi-devel] [PATCHv6 6/7] Update mockmodel of base img vm

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Wed Aug 6 09:03:47 UTC 2014


From: Royce Lv <lvroyce at linux.vnet.ibm.com>

Adding base img report in mockmodel

Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
---
 src/kimchi/control/storagevolumes.py | 2 +-
 src/kimchi/mockmodel.py              | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/kimchi/control/storagevolumes.py b/src/kimchi/control/storagevolumes.py
index edd696f..327bf75 100644
--- a/src/kimchi/control/storagevolumes.py
+++ b/src/kimchi/control/storagevolumes.py
@@ -58,7 +58,7 @@ class StorageVolume(Resource):
                'ref_cnt': self.info['ref_cnt'],
                'format': self.info['format']}
 
-        for key in ('os_version', 'os_distro', 'bootable'):
+        for key in ('os_version', 'os_distro', 'bootable', 'base'):
             val = self.info.get(key)
             if val:
                 res[key] = val
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 27ee50d..1b55c42 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -480,11 +480,13 @@ class MockModel(object):
         try:
             name = params['name']
             volume = MockStorageVolume(pool, name, params)
-            volume.info['type'] = params['type']
+            volume.info['type'] = 'file'
             volume.info['ref_cnt'] = params.get('ref_cnt', 0)
             volume.info['format'] = params['format']
             volume.info['path'] = os.path.join(
                 pool.info['path'], name)
+            if 'base' in params:
+                volume.info['base'] = copy.deepcopy(params['base'])
         except KeyError, item:
             raise MissingParameter("KCHVOL0004E",
                                    {'item': str(item), 'volume': name})
@@ -1002,6 +1004,8 @@ class MockVMTemplate(VMTemplate):
         for vol_info in volumes:
             vol_info['capacity'] = vol_info['capacity'] << 10
             vol_info['ref_cnt'] = 1
+            if 'base' in self.info:
+                vol_info['base'] = copy.deepcopy(self.info['base'])
             self.model.storagevolumes_create(pool.name, vol_info)
             disk_paths.append({'pool': pool.name, 'volume': vol_info['name']})
         return disk_paths
-- 
1.8.3.2




More information about the Kimchi-devel mailing list