[Kimchi-devel] [PATCH] issue#383: Only allow one type of parameter when adding vm storage
Aline Manera
alinefm at linux.vnet.ibm.com
Thu Jun 26 20:57:59 UTC 2014
On 06/26/2014 04:35 AM, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> When adding vm storage, volume and path cannot be specified
> at the same time. Fix it.
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
> src/kimchi/model/vmstorages.py | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
> index 8c51716..093b9ee 100644
> --- a/src/kimchi/model/vmstorages.py
> +++ b/src/kimchi/model/vmstorages.py
> @@ -154,6 +154,8 @@ class VMStoragesModel(object):
> # Path will never be blank due to API.json verification.
> # There is no need to cover this case here.
> params['format'] = 'raw'
> + if 'vol' in params and 'path' in params:
> + raise InvalidParameter("KCHVMSTOR0012E")
> if params.get('vol'):
> try:
> pool = params['pool']
This is one part of the solution we should have for #382
if type not in ['disk', 'cdrom']:
raise InvalidParameter(Disk type not support)
path = params.get(path, None)
if type == 'cdrom':
if not path:
raise MissingParameter()
# validate path and continue the logic
elif type == 'disk':
pool = params.get(pool, None)
vol = params.get(vol, None)
if not pool or not vol:
raise MissingParameter()
# validate values and continue the logic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/kimchi-devel/attachments/20140626/8d42c445/attachment.html>
More information about the Kimchi-devel
mailing list