Skip to content

Commit

Permalink
engine: Fix incorrect value in audit log warning
Browse files Browse the repository at this point in the history
The memory usage number in VDS_HIGH_MEM_USE warning should
be the usage of normal memory, not the total usage of
normal memory and hugepages memory. This patch corrects
the memory usage value in the audit log.

Bug-Url: https://bugzilla.redhat.com/2101503
  • Loading branch information
ljelinkova authored and ahadas committed Jul 20, 2022
1 parent f6efaa4 commit aaa3945
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private void checkVdsMemoryThresholdPercentage(Cluster cluster, VdsStatistics st
long memUsage = 100 - Math.round(100 * memFree / (double) memTotal);

if (memUsage > maxUsedPercentageThreshold) {
logMemoryAuditLog(vds, cluster, stat, AuditLogType.VDS_HIGH_MEM_USE, maxUsedPercentageThreshold);
logMemoryAuditLog(vds, cluster, memUsage, AuditLogType.VDS_HIGH_MEM_USE, maxUsedPercentageThreshold);
}
}

Expand All @@ -348,6 +348,19 @@ private void checkVdsMemoryThresholdAbsoluteValue(Cluster cluster, VdsStatistics
}
}

private void logMemoryAuditLog(VDS vds,
Cluster cluster,
Long memUsage,
AuditLogType valueToLog,
Integer threshold) {
AuditLogable logable = createAuditLogableForHost();
logable.addCustomValue("HostName", vds.getName());
logable.addCustomValue("Cluster", cluster.getName());
logable.addCustomValue("UsedMemory", memUsage.toString());
logable.addCustomValue("Threshold", threshold.toString());
auditLog(logable, valueToLog);
}

private void logMemoryAuditLog(VDS vds,
Cluster cluster,
VdsStatistics stat,
Expand Down

0 comments on commit aaa3945

Please sign in to comment.