On 06/26/2014 04:35 AM, lvroyce@linux.vnet.ibm.com wrote:
From: Royce Lv <lvroyce@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@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