mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
Add support for oom functions
Add tests for oom-kill-disable and oom-kill-adj Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #52 Approved by: TomSweeneyRedHat
This commit is contained in:

committed by
Atomic Bot

parent
b4bc7b8828
commit
c75c319ea2
@ -96,6 +96,7 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) {
|
|||||||
g.SetLinuxResourcesMemorySwappiness(config.resources.memorySwapiness)
|
g.SetLinuxResourcesMemorySwappiness(config.resources.memorySwapiness)
|
||||||
}
|
}
|
||||||
g.SetLinuxResourcesMemoryDisableOOMKiller(config.resources.disableOomKiller)
|
g.SetLinuxResourcesMemoryDisableOOMKiller(config.resources.disableOomKiller)
|
||||||
|
g.SetProcessOOMScoreAdj(config.resources.oomScoreAdj)
|
||||||
|
|
||||||
// RESOURCES - CPU
|
// RESOURCES - CPU
|
||||||
|
|
||||||
@ -176,7 +177,6 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
OOMScoreAdj: &config.resources.oomScoreAdj,
|
|
||||||
Hooks: &configSpec.Hooks{},
|
Hooks: &configSpec.Hooks{},
|
||||||
//Annotations
|
//Annotations
|
||||||
Resources: &configSpec.LinuxResources{
|
Resources: &configSpec.LinuxResources{
|
||||||
|
@ -101,9 +101,18 @@ IMAGE="docker.io/library/fedora:latest"
|
|||||||
echo $output
|
echo $output
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
run bash -c "export FOO=BAR; ${KPOD_BINARY} ${KPOD_OPTIONS} run --ulimit nofile=2048:2048 ${IMAGE} ulimit -n | tr -d '\r'"
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --ulimit nofile=2048:2048 ${IMAGE} ulimit -n | tr -d '\r'"
|
||||||
echo $output
|
echo $output
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ "$output" = 2048 ]
|
[ "$output" = 2048 ]
|
||||||
|
|
||||||
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --oom-kill-disable=true ${IMAGE} echo memory-hog"
|
||||||
|
echo $output
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
|
run bash -c "${KPOD_BINARY} ${KPOD_OPTIONS} run --oom-score-adj=100 ${IMAGE} cat /proc/self/oom_score_adj | tr -d '\r'"
|
||||||
|
echo $output
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[ "$output" = 100 ]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user