Currently memory_dom0 collected value is used for Xen and Kvm. In case
of Kvm collection is broken because the amount of memory used by
hypervisor includes the amount of memory used by instances as well.
Replace memory_dom0 with memory_node from hv_state parameter.

Signed-off-by: Oleg Ponomarev <[email protected]>
---
 lib/rapi/rlib2.py                 | 4 ++--
 src/Ganeti/HTools/Backend/Rapi.hs | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py
index 8fee8fb..70c6a5d 100644
--- a/lib/rapi/rlib2.py
+++ b/lib/rapi/rlib2.py
@@ -91,7 +91,7 @@ I_FIELDS = ["name", "admin_state", "os",
 
 N_FIELDS = ["name", "offline", "master_candidate", "drained",
             "dtotal", "dfree", "sptotal", "spfree",
-            "mtotal", "mnode", "mfree",
+            "mtotal", "mnode", "mfree", "hv_state",
             "pinst_cnt", "sinst_cnt",
             "ctotal", "cnos", "cnodes", "csockets",
             "pip", "sip", "role",
@@ -119,7 +119,7 @@ G_FIELDS = [
   "diskparams",
   "custom_diskparams",
   "ndparams",
-  "custom_ndparams",
+  "custom_ndparams"
   ] + _COMMON_FIELDS
 
 FILTER_RULE_FIELDS = [
diff --git a/src/Ganeti/HTools/Backend/Rapi.hs 
b/src/Ganeti/HTools/Backend/Rapi.hs
index df93d6a..2cf4bbc 100644
--- a/src/Ganeti/HTools/Backend/Rapi.hs
+++ b/src/Ganeti/HTools/Backend/Rapi.hs
@@ -186,8 +186,10 @@ parseNode ktg a = do
   ctotal <- lvextract 0.0 "ctotal"
   cnos <- lvextract 0 "cnos"
   tags <- extract "tags"
-  let node = flip Node.setNodeTags tags $
-             Node.create name mtotal mnode mfree dtotal dfree ctotal cnos
+  hv_state <- extractDef emptyContainer "hv_state"
+  let node_mem = obtainNodeMemory hv_state mnode
+      node = flip Node.setNodeTags tags $
+             Node.create name mtotal node_mem mfree dtotal dfree ctotal cnos
              (not live || drained) sptotal spfree guuid' excl_stor
   return (name, node)
 
-- 
2.6.0.rc2.230.g3dd15c0

Reply via email to