[PATCH][Kimchi] Improve checking of cpu_info API (json schema)

This patch adds a checking, retricting parameters expected in "cpu_info" and in "cpu_info: {topology }. Only defined parameters are allowed and new error messages are displayed if parameters do not fit requirement. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- API.json | 8 ++++++-- i18n.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/API.json b/API.json index ff505b1..590bc52 100644 --- a/API.json +++ b/API.json @@ -62,9 +62,13 @@ "minimum": 1, "error": "KCHTMPL0026E" } - } + }, + "additionalProperties": false, + "error": "KCHCPUINF0009E" } - } + }, + "additionalProperties": false, + "error": "KCHCPUINF0008E" }, "memory": { "description": "Current memory and maximum memory values", diff --git a/i18n.py b/i18n.py index 12b70fa..6491f72 100644 --- a/i18n.py +++ b/i18n.py @@ -325,6 +325,8 @@ messages = { "KCHCPUINF0005E": _("When CPU topology is defined, vCPUs must be a multiple of a product of cores and threads."), "KCHCPUINF0006E": _("The number of threads is too large for this system."), "KCHCPUINF0007E": _("When CPU topology is specified, sockets, cores and threads are required paramaters."), + "KCHCPUINF0008E": _("Parameter 'cpu_info' expects an object with fields among: 'vcpus', 'maxvcpus', 'topology'."), + "KCHCPUINF0009E": _("Parameter 'topology' expects an object with fields among: 'sockets', 'cores', 'threads'."), "KCHLVMS0001E": _("Invalid volume group name parameter: %(name)s."), -- 2.1.0

Reviewed-by: Paulo Vital <pvital@linux.vnet.ibm.com> On Apr 14 02:12PM, Rodrigo Trujillo wrote:
This patch adds a checking, retricting parameters expected in "cpu_info" and in "cpu_info: {topology }. Only defined parameters are allowed and new error messages are displayed if parameters do not fit requirement.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- API.json | 8 ++++++-- i18n.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/API.json b/API.json index ff505b1..590bc52 100644 --- a/API.json +++ b/API.json @@ -62,9 +62,13 @@ "minimum": 1, "error": "KCHTMPL0026E" } - } + }, + "additionalProperties": false, + "error": "KCHCPUINF0009E" } - } + }, + "additionalProperties": false, + "error": "KCHCPUINF0008E" }, "memory": { "description": "Current memory and maximum memory values", diff --git a/i18n.py b/i18n.py index 12b70fa..6491f72 100644 --- a/i18n.py +++ b/i18n.py @@ -325,6 +325,8 @@ messages = { "KCHCPUINF0005E": _("When CPU topology is defined, vCPUs must be a multiple of a product of cores and threads."), "KCHCPUINF0006E": _("The number of threads is too large for this system."), "KCHCPUINF0007E": _("When CPU topology is specified, sockets, cores and threads are required paramaters."), + "KCHCPUINF0008E": _("Parameter 'cpu_info' expects an object with fields among: 'vcpus', 'maxvcpus', 'topology'."), + "KCHCPUINF0009E": _("Parameter 'topology' expects an object with fields among: 'sockets', 'cores', 'threads'."),
"KCHLVMS0001E": _("Invalid volume group name parameter: %(name)s."),
-- 2.1.0
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
-- Paulo Ricardo Paz Vital Linux Technology Center, IBM Systems http://www.ibm.com/linux/ltc/

Reviewed-by: Daniel Barboza <dhbarboza82@gmail.com> On 04/14/2016 02:12 PM, Rodrigo Trujillo wrote:
This patch adds a checking, retricting parameters expected in "cpu_info" and in "cpu_info: {topology }. Only defined parameters are allowed and new error messages are displayed if parameters do not fit requirement.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- API.json | 8 ++++++-- i18n.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/API.json b/API.json index ff505b1..590bc52 100644 --- a/API.json +++ b/API.json @@ -62,9 +62,13 @@ "minimum": 1, "error": "KCHTMPL0026E" } - } + }, + "additionalProperties": false, + "error": "KCHCPUINF0009E" } - } + }, + "additionalProperties": false, + "error": "KCHCPUINF0008E" }, "memory": { "description": "Current memory and maximum memory values", diff --git a/i18n.py b/i18n.py index 12b70fa..6491f72 100644 --- a/i18n.py +++ b/i18n.py @@ -325,6 +325,8 @@ messages = { "KCHCPUINF0005E": _("When CPU topology is defined, vCPUs must be a multiple of a product of cores and threads."), "KCHCPUINF0006E": _("The number of threads is too large for this system."), "KCHCPUINF0007E": _("When CPU topology is specified, sockets, cores and threads are required paramaters."), + "KCHCPUINF0008E": _("Parameter 'cpu_info' expects an object with fields among: 'vcpus', 'maxvcpus', 'topology'."), + "KCHCPUINF0009E": _("Parameter 'topology' expects an object with fields among: 'sockets', 'cores', 'threads'."),
"KCHLVMS0001E": _("Invalid volume group name parameter: %(name)s."),
participants (4)
-
Aline Manera
-
Daniel Henrique Barboza
-
Paulo Ricardo Paz Vital
-
Rodrigo Trujillo