From 1e7e276aff03893ccb243311e2cbeb9edeae8198 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Wed, 26 Apr 2017 09:53:20 -0700 Subject: [PATCH] Allow updating container pids limit Signed-off-by: Kenfe-Mickael Laventure --- tests/integration/update.bats | 23 +++++++++++++++++++++-- update.go | 9 +++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/integration/update.bats b/tests/integration/update.bats index 4a6bf7fc..a3f37828 100644 --- a/tests/integration/update.bats +++ b/tests/integration/update.bats @@ -33,6 +33,9 @@ function setup() { "blockio": { "blkioWeight": 1000 }, + "pids": { + "limit": 20 + }, EOF ) DATA=$(echo ${DATA} | sed 's/\n/\\n/g') @@ -61,7 +64,7 @@ function check_cgroup_value() { wait_for_container 15 1 test_update # get the cgroup paths - for g in MEMORY CPUSET CPU BLKIO; do + for g in MEMORY CPUSET CPU BLKIO PIDS; do base_path=$(grep "cgroup" /proc/self/mountinfo | gawk 'toupper($NF) ~ /\<'${g}'\>/ { print $5; exit }') eval CGROUP_${g}="${base_path}/runc-update-integration-test" done @@ -78,6 +81,7 @@ function check_cgroup_value() { check_cgroup_value $CGROUP_MEMORY "memory.kmem.tcp.limit_in_bytes" 11534336 check_cgroup_value $CGROUP_MEMORY "memory.limit_in_bytes" 33554432 check_cgroup_value $CGROUP_MEMORY "memory.soft_limit_in_bytes" 25165824 + check_cgroup_value $CGROUP_PIDS "pids.max" 20 # update blkio-weight runc update test_update --blkio-weight 500 @@ -160,6 +164,11 @@ function check_cgroup_value() { [ "$status" -eq 0 ] check_cgroup_value $CGROUP_MEMORY "memory.kmem.tcp.limit_in_bytes" 41943040 + # update pids limit + runc update test_update --pids-limit 10 + [ "$status" -eq 0 ] + check_cgroup_value $CGROUP_PIDS "pids.max" 10 + # Revert to the test initial value via json on stding runc update -r - test_update <