[Kimchi-devel] [PATCH][Kimchi] Add error message when empty disks list is passed in Template edit API

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Mon Apr 25 14:51:33 UTC 2016


If user gives an empty disk list "[]" when editing a Template, the json
schema is going to return a standard error that has not useful meaning
to end user. This patch adds a more meaningful error message.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 API.json | 3 ++-
 i18n.py  | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/API.json b/API.json
index 5ef4f55..380ed19 100644
--- a/API.json
+++ b/API.json
@@ -714,7 +714,8 @@
                         }
                     },
                     "minItems": 1,
-                    "uniqueItems": true
+                    "uniqueItems": true,
+                    "error": "KCHTMPL0033E"
                 },
                 "networks": {
                     "description": "list of which networks will be assigned to the new VM.",
diff --git a/i18n.py b/i18n.py
index 9a3f4a1..39f5e57 100644
--- a/i18n.py
+++ b/i18n.py
@@ -183,6 +183,7 @@ messages = {
     "KCHTMPL0030E": _("Memory expects an object with one or both parameters: 'current' and 'maxmemory'"),
     "KCHTMPL0031E": _("Memory value (%(mem)sMiB) must be equal or lesser than maximum memory value (%(maxmem)sMiB)"),
     "KCHTMPL0032E": _("Unable to update template due error: %(err)s"),
+    "KCHTMPL0033E": _("Parameter 'disks' requires at least one disk object"),
 
     "KCHPOOL0001E": _("Storage pool %(name)s already exists"),
     "KCHPOOL0002E": _("Storage pool %(name)s does not exist"),
-- 
2.1.0




More information about the Kimchi-devel mailing list