mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
fix misleading log about swap being on
Currently, a log is triggered about swap being on even if swap is off. After this commit, the log would be triggered only if swap is truly turned on. Signed-off-by: Itamar Holder <iholder@redhat.com>
This commit is contained in:
parent
7ad1eaa66b
commit
b811af496c
@ -110,8 +110,12 @@ func isSwapOnAccordingToProcSwaps(procSwapsContent []byte) bool {
|
||||
procSwapsLines := strings.Split(procSwapsStr, "\n")
|
||||
|
||||
// If there is more than one line (table headers) in /proc/swaps then swap is enabled
|
||||
klog.InfoS("Swap is on", "/proc/swaps contents", procSwapsStr)
|
||||
return len(procSwapsLines) > 1
|
||||
isSwapOn := len(procSwapsLines) > 1
|
||||
if isSwapOn {
|
||||
klog.InfoS("Swap is on", "/proc/swaps contents", procSwapsStr)
|
||||
}
|
||||
|
||||
return isSwapOn
|
||||
}
|
||||
|
||||
// IsSwapOn detects whether swap in enabled on the system by inspecting
|
||||
|
Loading…
Reference in New Issue
Block a user