[Kimchi-devel] [PATCH v2][Kimchi] Bug fix #1026: CentOS: Unable to get and update memory values for a powered off guest

Ramon Medeiros ramonn at linux.vnet.ibm.com
Tue Dec 13 17:05:14 UTC 2016


Parse vm memory from xml when it isn't available at dom.info

Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
Changes:

v2:
Parse memory before count hotplug devices

 model/vms.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/model/vms.py b/model/vms.py
index 3ea1122..f752271 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -105,6 +105,7 @@ XPATH_BOOT = 'os/boot/@dev'
 XPATH_BOOTMENU = 'os/bootmenu/@enable'
 XPATH_CPU = './cpu'
 XPATH_DESCRIPTION = './description'
+XPATH_MEMORY = './memory'
 XPATH_NAME = './name'
 XPATH_NUMA_CELL = './cpu/numa/cell'
 XPATH_SNAP_VM_NAME = './domain/name'
@@ -1342,6 +1343,12 @@ class VMModel(object):
         # Case VM changed currentMemory outside Kimchi, sum mem devs
         memory = dom.maxMemory() >> 10
         curr_mem = (info[2] >> 10)
+
+        # On CentOS, dom.info does not retrieve memory. So, if machine does
+        # not have memory hotplug, parse memory from xml
+        if curr_mem == 0:
+            curr_mem = int(xpath_get_text(xml, XPATH_MEMORY)[0]) >> 10
+
         if memory != curr_mem:
             memory = curr_mem + (self._get_mem_dev_total_size(xml) >> 10)
 
-- 
2.7.4




More information about the Kimchi-devel mailing list