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

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Tue Dec 8 16:15:02 UTC 2015


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']
                 session.store('template', name, t.info,
                               get_kimchi_version())
         except InvalidOperation:
-- 
2.1.0




More information about the Kimchi-devel mailing list