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

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Fri Apr 15 11:13:47 UTC 2016


Reviewed-by: Paulo Vital <pvital at 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 at 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 at 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/




More information about the Kimchi-devel mailing list