[Kimchi-devel] [PATCH v2] VM template: add disk size error message

Royce Lv lvroyce at linux.vnet.ibm.com
Thu May 15 06:39:47 UTC 2014


Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
On 05/15/2014 01:20 PM, Zhou Zheng Sheng wrote:
> The schema checker needs to report an error message when the disk size
> is less than 1GB. Currently this message is missing, so it reports an
> KeyError. This patch adds the error message.
>
> How to trigger this bug:
> 1. In Web UI, create a template as usual.
> 2. Edit the template, define the disk size as 0.5.
>
> v2:
>    v1 adds the error to "disks", but the error is not raised against it.
>    v2 correctly adds the error message to the "size" constraint.
>
> Signed-off-by: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
> ---
>   src/kimchi/API.json | 6 ++++--
>   src/kimchi/i18n.py  | 1 +
>   2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/API.json b/src/kimchi/API.json
> index b9d371a..76c94ab 100644
> --- a/src/kimchi/API.json
> +++ b/src/kimchi/API.json
> @@ -379,7 +379,8 @@
>                               "size": {
>                                   "description": "Size (GB) of the disk",
>                                   "type": "number",
> -                                "minimum": 1
> +                                "minimum": 1,
> +                                "error": "KCHTMPL0022E"
>                               }
>                           }
>                       },
> @@ -549,7 +550,8 @@
>                               "size": {
>                                   "description": "Size (GB) of the disk",
>                                   "type": "number",
> -                                "minimum": 1
> +                                "minimum": 1,
> +                                "error": "KCHTMPL0022E"
>                               }
>                           }
>                       },
> diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py
> index 25b703f..e105e50 100644
> --- a/src/kimchi/i18n.py
> +++ b/src/kimchi/i18n.py
> @@ -119,6 +119,7 @@ messages = {
>       "KCHTMPL0019E": _("The volume: %(volume)s in not in storage pool %(pool)s"),
>       "KCHTMPL0020E": _("Unable to create template due error: %(err)s"),
>       "KCHTMPL0021E": _("Unable to delete template due error: %(err)s"),
> +    "KCHTMPL0022E": _("Disk size must be greater than 1GB."),
>
>       "KCHPOOL0001E": _("Storage pool %(name)s already exists"),
>       "KCHPOOL0002E": _("Storage pool %(name)s does not exist"),




More information about the Kimchi-devel mailing list