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 Signed-off-by: Eli Mesika <emes...@redhat.com> --- M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java 1 file changed, 7 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/64/33164/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 90837a1..ff4220e 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 @@ -529,6 +529,7 @@ */ private void checkVdsSwapThreshold(VdsStatistics stat) { + final double THRESHOLD = 0.98; Integer minAvailableThreshold = Config.getValue(ConfigValues.LogPhysicalMemoryThresholdInMB); Integer maxUsedPercentageThreshold = Config.getValue(ConfigValues.LogMaxPhysicalMemoryUsedThresholdInPercentage); @@ -539,17 +540,19 @@ 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 then 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 ? - minAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); + logable.addCustomValue("Threshold", stat.getswap_free() < allowedMinAvailableThreshold ? + allowedMinAvailableThreshold.toString() : maxUsedPercentageThreshold.toString()); auditLog(logable, valueToLog); } } -- To view, visit http://gerrit.ovirt.org/33164 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia3f5da5398141eeba83549a7e425e9f6b9f8673e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches