Mei Liu has uploaded a new change for review.

Change subject: mom: modifiy libvirt interface to get correct memory stats 
fields
......................................................................

mom: modifiy libvirt interface to get correct memory stats fields

The original implementation sets memory stats fileds to mem_available,
mem_unused, etc which can be obtained through libivirt memoryStats API.
This information can be get from older version of qemu, but it cann't
be obtained in newer version through the same API.
This patch fixes the fields and related variables in policy.

Change-Id: If2f00b96f061bc7770745afe559b1af60c4c9c08
Signed-off-by: MeiLiu <liu...@linux.vnet.ibm.com>
---
M doc/balloon.rules
M mom/HypervisorInterfaces/libvirtInterface.py
2 files changed, 5 insertions(+), 36 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/mom refs/changes/56/17956/1

diff --git a/doc/balloon.rules b/doc/balloon.rules
index 42990a7..7eeb054 100644
--- a/doc/balloon.rules
+++ b/doc/balloon.rules
@@ -5,14 +5,6 @@
 # then we will consider the host to be under memory pressure
 (defvar pressure_threshold 0.20)
 
-# If pressure threshold drops below this level, then the pressure
-# is critical and more aggressive ballooning will be employed.
-(defvar pressure_critical 0.05)
-
-# This is the minimum percentage of free memory that an unconstrained
-# guest would like to maintain
-(defvar min_guest_free_percent 0.20)
-
 # Don't change a guest's memory by more than this percent of total memory
 (defvar max_balloon_change_percent 0.05)
 
@@ -33,21 +25,7 @@
 
 (def shrink_guest (guest)
 {
-    # Determine the degree of host memory pressure
-    (if (<= host_free_percent pressure_critical)
-        # Pressure is critical:
-        #   Force guest to swap by making free memory negative
-        (defvar guest_free_percent (+ -0.05 host_free_percent))
-        # Normal pressure situation
-        #   Scale the guest free memory back according to host pressure
-        (defvar guest_free_percent (* min_guest_free_percent
-                                    (/ host_free_percent pressure_threshold))))
-
-    # Given current conditions, determine the ideal guest memory size
-    (defvar guest_used_mem (- (guest.StatAvg "balloon_cur")
-                              (guest.StatAvg "mem_unused")))
-    (defvar balloon_min (min guest.balloon_min (+ guest_used_mem
-                           (* guest_free_percent guest.balloon_cur))))
+    (defvar balloon_min guest.balloon_min)
     # But do not change it too fast
     (defvar balloon_size (* guest.balloon_cur
                             (- 1 max_balloon_change_percent)))
@@ -67,10 +45,7 @@
     # There is only work to do if the guest is ballooned
     (if (< guest.balloon_cur guest.balloon_max) {
         # Minimally, increase so the guest has its desired free memory
-        (defvar guest_used_mem (- (guest.StatAvg "balloon_cur")
-                                  (guest.StatAvg "mem_unused")))
-        (defvar balloon_min (min guest.balloon_min (+ guest_used_mem
-                               (* guest_free_percent guest.balloon_cur))))
+        (defvar balloon_min guest.balloon_min)
         # Otherwise, increase according to the max balloon change
         (defvar balloon_size (* guest.balloon_cur
                                 (+ 1 max_balloon_change_percent)))
diff --git a/mom/HypervisorInterfaces/libvirtInterface.py 
b/mom/HypervisorInterfaces/libvirtInterface.py
index a1bf71b..ad28bd3 100644
--- a/mom/HypervisorInterfaces/libvirtInterface.py
+++ b/mom/HypervisorInterfaces/libvirtInterface.py
@@ -195,16 +195,10 @@
         """
         The following additional statistics may be available depending on the
         libvirt version, qemu version, and guest operation system version:
-            mem_available - Total amount of memory available (kB)
-            mem_unused - Amount of free memory not including caches (kB)
-            major_fault - Total number of major page faults
-            minor_fault - Total number of minor page faults
-            swap_in - Total amount of memory swapped in (kB)
-            swap_out - Total amount of memory swapped out (kB)
+            balloon_actual - Actual balloon value.
+            rss - The resident set size counts the number of resident 
pages(KiB).
         """
-        self.mem_stats = { 'available': 'mem_available', 'unused': 
'mem_unused',
-                      'major_fault': 'major_fault', 'minor_fault': 
'minor_fault',
-                      'swap_in': 'swap_in', 'swap_out': 'swap_out' }
+        self.mem_stats = { 'actual': 'actual', 'rss': 'rss'}
 
     def getStatsFields(self):
         return set(self.mem_stats.values())


-- 
To view, visit http://gerrit.ovirt.org/17956
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If2f00b96f061bc7770745afe559b1af60c4c9c08
Gerrit-PatchSet: 1
Gerrit-Project: mom
Gerrit-Branch: master
Gerrit-Owner: Mei Liu <liu...@linux.vnet.ibm.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to