mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 15:50:10 +00:00
Merge pull request #127325 from iholder101/swap/fix-swap-on-log
Swap: Fix misleading log about swap being on, even if it's actually off
This commit is contained in:
commit
359b9ba9bf
@ -110,8 +110,12 @@ func isSwapOnAccordingToProcSwaps(procSwapsContent []byte) bool {
|
|||||||
procSwapsLines := strings.Split(procSwapsStr, "\n")
|
procSwapsLines := strings.Split(procSwapsStr, "\n")
|
||||||
|
|
||||||
// If there is more than one line (table headers) in /proc/swaps then swap is enabled
|
// 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)
|
isSwapOn := len(procSwapsLines) > 1
|
||||||
return 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
|
// IsSwapOn detects whether swap in enabled on the system by inspecting
|
||||||
|
Loading…
Reference in New Issue
Block a user