<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 06/26/2014 04:35 AM,
<a class="moz-txt-link-abbreviated" href="mailto:lvroyce@linux.vnet.ibm.com">lvroyce@linux.vnet.ibm.com</a> wrote:<br>
</div>
<blockquote
cite="mid:1403768132-9897-1-git-send-email-lvroyce@linux.vnet.ibm.com"
type="cite">
<pre wrap="">From: Royce Lv <a class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com"><lvroyce@linux.vnet.ibm.com></a>
When adding vm storage, volume and path cannot be specified
at the same time. Fix it.
Signed-off-by: Royce Lv <a class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com"><lvroyce@linux.vnet.ibm.com></a>
---
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']
</pre>
</blockquote>
<br>
<font face="DejaVu Sans Mono">This is one part of the solution we
should have for #382<br>
<br>
if type not in ['disk', 'cdrom']:<br>
raise InvalidParameter(Disk type not support)<br>
<br>
path = params.get(path, None)<br>
if type == 'cdrom':<br>
if not path:<br>
raise MissingParameter()<br>
<br>
# validate path and continue the logic<br>
<br>
elif type == 'disk':<br>
pool = params.get(pool, None)<br>
vol = params.get(vol, None)<br>
if not pool or not vol:<br>
raise MissingParameter()<br>
<br>
# validate values and continue the logic<br>
<br>
<br>
<br>
<br>
</font>
</body>
</html>