[Kimchi-devel] [PATCHv3 7/8] Update mockmodel of base img vm
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Jul 21 18:16:26 UTC 2014
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 07/20/2014 12:08 PM, lvroyce0210 at gmail.com wrote:
> 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 ccaa4d8..ec8730d 100644
> --- a/src/kimchi/mockmodel.py
> +++ b/src/kimchi/mockmodel.py
> @@ -487,6 +487,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})
> @@ -1004,6 +1006,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
More information about the Kimchi-devel
mailing list