[Kimchi-devel] [PATCHv2] ISSUE#466: Filter valid format only on volume type of 'file'
Aline Manera
alinefm at linux.vnet.ibm.com
Fri Oct 31 13:55:03 UTC 2014
Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
On 10/31/2014 10:29 AM, lvroyce0210 at gmail.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> When volume type is block,
> filter will prevent volume to be attached due to its format is 'unknown'.
> Change the filter to only apply to 'file' type,
> so that block will not be blocked.
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
> src/kimchi/model/vmstorages.py | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
> index 055aa50..fea110f 100644
> --- a/src/kimchi/model/vmstorages.py
> +++ b/src/kimchi/model/vmstorages.py
> @@ -153,17 +153,18 @@ class VMStoragesModel(object):
> if vol_info['ref_cnt'] != 0:
> raise InvalidParameter("KCHVMSTOR0016E")
>
> - supported_format = {
> + params['path'] = vol_info['path']
> + valid_format = {
> "disk": ["raw", "bochs", "qcow", "qcow2", "qed", "vmdk"],
> "cdrom": "iso"}
> - if vol_info['format'] in supported_format[params['type']]:
> - if params['type'] == 'disk':
> + if vol_info['type'] == 'file':
> + if (params['type'] == 'disk' and
> + vol_info['format'] in valid_format[params['type']]):
> params['format'] = vol_info['format']
> - else:
> - raise InvalidParameter("KCHVMSTOR0018E",
> - {"format": vol_info['format'],
> - "type": params['type']})
> - params['path'] = vol_info['path']
> + else:
> + raise InvalidParameter("KCHVMSTOR0018E",
> + {"format": vol_info['format'],
> + "type": params['type']})
> params['src_type'] = _check_path(params['path'])
> if (params['bus'] not in HOTPLUG_TYPE
> and DOM_STATE_MAP[dom.info()[0]] != 'shutoff'):
More information about the Kimchi-devel
mailing list