[Kimchi-devel] [PATCH] Issue #753: Avoid store max_memory in Templates records

Aline Manera alinefm at linux.vnet.ibm.com
Thu Dec 10 18:03:50 UTC 2015



On 08/12/2015 14:15, Rodrigo Trujillo wrote:
> When Kimchi creates a new template, it is recording the value of
> max_memory. This value is related to host and guest memory assigned or
> updated. If the value remains in objectstore, Kimchi will always use
> it, what is wrong, since host total memory or guest memory can change,
> and this should update max_memory value as well.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   model/templates.py | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/model/templates.py b/model/templates.py
> index 84cdd02..eb72ea1 100644
> --- a/model/templates.py
> +++ b/model/templates.py
> @@ -95,6 +95,9 @@ class TemplatesModel(object):
>               with self.objstore as session:
>                   if name in session.get_list('template'):
>                       raise InvalidOperation("KCHTMPL0001E", {'name': name})

> +                # It is not necessary to store max_memory in Template record
> +                if 'max_memory' in t.info:
> +                    del t.info['max_memory']

Instead of removing the max_memory when creating the Template, it should 
have never been there.
We should remove it from osinfo and request the information when need.

>                   session.store('template', name, t.info,
>                                 get_kimchi_version())
>           except InvalidOperation:




More information about the Kimchi-devel mailing list