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

lvroyce at linux.vnet.ibm.com lvroyce at linux.vnet.ibm.com
Thu Jul 24 09:02:23 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              | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/kimchi/control/storagevolumes.py b/src/kimchi/control/storagevolumes.py
index c4d6c41..983c52c 100644
--- a/src/kimchi/control/storagevolumes.py
+++ b/src/kimchi/control/storagevolumes.py
@@ -52,7 +52,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 db4d465..6121d98 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -469,6 +469,8 @@ class MockModel(object):
             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})
@@ -986,6 +988,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