
On 2014年06月26日 21:10, Sheldon wrote:
On 06/26/2014 03:35 PM, 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") "KCHVMSTOR0012E": _("Specify type and path or type and pool/volume to add a new virtual machine disk")
It is OK.
But IMHO, a more precise error message is better for user, such as "can not specify both path and pool/volume to a new virtual machine disk" ACK.
if params.get('vol'): try: pool = params['pool']