diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-11-20 12:50:55 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-21 15:33:16 +0000 |
commit | c75c319ea2b818cad25061ba6b77b55db28ab869 (patch) | |
tree | bd1d6665b6c163fa746bea3339b578f4e03a54de | |
parent | b4bc7b8828f560627d080ed6e383cb12f9f7f5b3 (diff) | |
download | podman-c75c319ea2b818cad25061ba6b77b55db28ab869.tar.gz podman-c75c319ea2b818cad25061ba6b77b55db28ab869.tar.bz2 podman-c75c319ea2b818cad25061ba6b77b55db28ab869.zip |
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
-rw-r--r-- | cmd/kpod/spec.go | 2 | ||||
-rw-r--r-- | test/kpod_run.bats | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/cmd/kpod/spec.go b/cmd/kpod/spec.go index 69e81d0e5..1ae050d25 100644 --- a/cmd/kpod/spec.go +++ b/cmd/kpod/spec.go @@ -96,6 +96,7 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { g.SetLinuxResourcesMemorySwappiness(config.resources.memorySwapiness) } g.SetLinuxResourcesMemoryDisableOOMKiller(config.resources.disableOomKiller) + g.SetProcessOOMScoreAdj(config.resources.oomScoreAdj) // RESOURCES - CPU @@ -176,7 +177,6 @@ func createConfigToOCISpec(config *createConfig) (*spec.Spec, error) { } /* - OOMScoreAdj: &config.resources.oomScoreAdj, Hooks: &configSpec.Hooks{}, //Annotations Resources: &configSpec.LinuxResources{ diff --git a/test/kpod_run.bats b/test/kpod_run.bats index 203fcc0cc..5c38c37da 100644 --- a/test/kpod_run.bats +++ b/test/kpod_run.bats @@ -101,9 +101,18 @@ IMAGE="docker.io/library/fedora:latest" echo $output [ "$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 [ "$status" -eq 0 ] [ "$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 ] + } |