On 12/09/2016 05:09 PM, Ramon Medeiros wrote:
Parse vm memory from xml when it isn't available at dom.info
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
model/vms.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/model/vms.py b/model/vms.py
index bff7ed2..22bb5ec 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -104,6 +104,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'
@@ -1307,6 +1308,11 @@ class VMModel(object):
if memory != curr_mem:
memory = curr_mem + (self._get_mem_dev_total_size(xml) >> 10)
+ # On CentOS, dom.info does not retrieve memory.
So, if machine does
+ # not have memory hotplug, parse memory from xml
What do you mean about "if machine does not have memory hotplug" ? And
where are you checking it?
+ if memory == 0:
+ memory = int(xpath_get_text(xml, XPATH_MEMORY)[0]) >> 10
+
# assure there is no zombie process left
for proc in self._serial_procs[:]:
if not proc.is_alive():