On 2014年10月30日 21:42, Aline Manera wrote:
On 10/30/2014 10:08 AM, lvroyce0210(a)gmail.com wrote:
> From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
>
> When src_type is block and volume is iscsi,
> filter will prevent volume to be attached due to its format is
> 'unknown'.
> Change the filter to only apply to 'file' src_type,
> so that iscsi volume will not be blocked.
>
> Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
> ---
> src/kimchi/model/vmstorages.py | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/src/kimchi/model/vmstorages.py
> b/src/kimchi/model/vmstorages.py
> index 055aa50..a48d9fa 100644
> --- a/src/kimchi/model/vmstorages.py
> +++ b/src/kimchi/model/vmstorages.py
> @@ -153,17 +153,19 @@ class VMStoragesModel(object):
> if vol_info['ref_cnt'] != 0:
> raise InvalidParameter("KCHVMSTOR0016E")
>
> - supported_format = {
> + params['path'] = vol_info['path']
> + params['src_type'] = _check_path(params['path'])
You can get the type from vol_info: vol_info['type'] that is the
information provided by libvirt.
ACK
> + 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 params['src_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'):
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel