Eli Mesika has uploaded a new change for review.

Change subject: core: allow 2% gap in host low swap
......................................................................

core: allow 2% gap in host low swap

This patch change the computation of low swap memory such that it allows
a 2% gap between the configured low swap value
(LogPhysicalMemoryThresholdInMB) and the actual one in order to prevent
th engine log to be flooded with warning when the actual value is OK.

Change-Id: Ia3f5da5398141eeba83549a7e425e9f6b9f8673e
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1135909
Signed-off-by: Eli Mesika <[email protected]>
---
M 
backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/65/33265/1

diff --git 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
index e23c43a..5ea2809 100644
--- 
a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
+++ 
b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java
@@ -463,6 +463,7 @@
      */
     private void checkVdsSwapThreshold(VdsStatistics stat) {
 
+        final double THRESHOLD = 0.98;
         Integer minAvailableThreshold = 
Config.getValue(ConfigValues.LogPhysicalMemoryThresholdInMB);
         Integer maxUsedPercentageThreshold =
                 
Config.getValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage);
@@ -473,16 +474,18 @@
 
         Long swapUsedPercent = (stat.getswap_total() - stat.getswap_free()) / 
stat.getswap_total();
 
-        AuditLogType valueToLog = stat.getswap_free() < minAvailableThreshold ?
+        // Allow the space to be up to 2% lower than as defined in 
configuration
+        Long allowedMinAvailableThreshold = 
Math.round(minAvailableThreshold.doubleValue() * THRESHOLD);
+        AuditLogType valueToLog = stat.getswap_free() <  
allowedMinAvailableThreshold ?
                 AuditLogType.VDS_LOW_SWAP :
                 AuditLogType.VDS_HIGH_SWAP_USE;
 
-        if (stat.getswap_free() < minAvailableThreshold || swapUsedPercent > 
maxUsedPercentageThreshold) {
+        if (stat.getswap_free() < allowedMinAvailableThreshold || 
swapUsedPercent > maxUsedPercentageThreshold) {
             AuditLogableBase logable = new AuditLogableBase(stat.getId());
             logable.addCustomValue("HostName", _vds.getName());
             logable.addCustomValue("UsedSwap", swapUsedPercent.toString());
             logable.addCustomValue("AvailableSwapMemory", 
stat.getswap_free().toString());
-            logable.addCustomValue("Threshold", stat.getswap_free() < 
minAvailableThreshold ?
+            logable.addCustomValue("Threshold", stat.getswap_free() < 
allowedMinAvailableThreshold ?
                     minAvailableThreshold.toString() : 
maxUsedPercentageThreshold.toString());
             auditLog(logable, valueToLog);
         }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia3f5da5398141eeba83549a7e425e9f6b9f8673e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Eli Mesika <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to