From e83ca5191304963b66f6a917d119ac6c1fb5ef8d Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 16 May 2023 12:27:46 -0700 Subject: [PATCH 1/3] tests/int/cgroups: filter out rdma Filter out rdma controller since systemd is unable to delegate it. Similar to commits 05272718f4ec414d and 601cf5825f6cf7cd4c360. Signed-off-by: Kir Kolyshkin --- tests/integration/cgroups.bats | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/cgroups.bats b/tests/integration/cgroups.bats index 17e384e2c..89d4b3626 100644 --- a/tests/integration/cgroups.bats +++ b/tests/integration/cgroups.bats @@ -49,8 +49,8 @@ function setup() { if [ $EUID -eq 0 ]; then check_cgroup_value "cgroup.controllers" "$(cat /sys/fs/cgroup/machine.slice/cgroup.controllers)" else - # Filter out hugetlb and misc as systemd is unable to delegate them. - check_cgroup_value "cgroup.controllers" "$(sed -e 's/ hugetlb//' -e 's/ misc//' Date: Tue, 9 Aug 2022 14:10:22 -0700 Subject: [PATCH 2/3] tests/int: rename a variable Rename CGROUP_PATH to CGROUP_V2_PATH so it is more clear that it can only be used for CGROUP_V2, and to resolve ambiguity with CGROUP_PATH variable used in tests/rootless.sh. Signed-off-by: Kir Kolyshkin --- tests/integration/cgroups.bats | 2 +- tests/integration/delete.bats | 4 ++-- tests/integration/helpers.bash | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/cgroups.bats b/tests/integration/cgroups.bats index 89d4b3626..1842bdcf3 100644 --- a/tests/integration/cgroups.bats +++ b/tests/integration/cgroups.bats @@ -386,7 +386,7 @@ function setup() { FREEZER="${FREEZER_DIR}/freezer.state" STATE="FROZEN" else - FREEZER_DIR="${CGROUP_PATH}" + FREEZER_DIR="${CGROUP_V2_PATH}" FREEZER="${FREEZER_DIR}/cgroup.freeze" STATE="1" fi diff --git a/tests/integration/delete.bats b/tests/integration/delete.bats index 9b95b845a..efd43de5b 100644 --- a/tests/integration/delete.bats +++ b/tests/integration/delete.bats @@ -157,7 +157,7 @@ EOF [[ "$output" =~ [0-9]+ ]] # check create subcgroups success - [ -d "$CGROUP_PATH"/foo ] + [ -d "$CGROUP_V2_PATH"/foo ] # force delete test_busybox runc delete --force test_busybox @@ -166,5 +166,5 @@ EOF [ "$status" -ne 0 ] # check delete subcgroups success - [ ! -d "$CGROUP_PATH"/foo ] + [ ! -d "$CGROUP_V2_PATH"/foo ] } diff --git a/tests/integration/helpers.bash b/tests/integration/helpers.bash index ee2e9c9e0..7b1cc4a08 100644 --- a/tests/integration/helpers.bash +++ b/tests/integration/helpers.bash @@ -220,7 +220,7 @@ function set_cgroups_path() { # Absolute path to container's cgroup v2. if [ -v CGROUP_V2 ]; then - CGROUP_PATH=${CGROUP_BASE_PATH}${REL_CGROUPS_PATH} + CGROUP_V2_PATH=${CGROUP_BASE_PATH}${REL_CGROUPS_PATH} fi [ -v pod ] && create_parent @@ -233,7 +233,7 @@ function set_cgroups_path() { # $1: controller name (like "pids") or a file name (like "pids.max"). function get_cgroup_path() { if [ -v CGROUP_V2 ]; then - echo "$CGROUP_PATH" + echo "$CGROUP_V2_PATH" return fi From 78d31a49411392f79209d8337361745e87562a39 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 8 Aug 2022 16:11:17 -0700 Subject: [PATCH 3/3] ci/cirrus: enable rootless tests on cs9 We were not running localrootlessintegration test on CentOS Stream 9 because of some failures fixed by previous commits. Enable rootless integration with both systemd and fs drivers. Signed-off-by: Kir Kolyshkin --- .cirrus.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index c6d238726..e09df466d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -111,6 +111,11 @@ task: centos-stream-9) dnf config-manager --set-enabled crb # for glibc-static dnf -y install epel-release epel-next-release # for fuse-sshfs + # Delegate all cgroup v2 controllers to rootless user via --systemd-cgroup. + # The default (since systemd v252) is "pids memory cpu". + mkdir -p /etc/systemd/system/user@.service.d + printf "[Service]\nDelegate=yes\n" > /etc/systemd/system/user@.service.d/delegate.conf + systemctl daemon-reload ;; esac # Work around dnf mirror failures by retrying a few times. @@ -175,13 +180,19 @@ task: integration_fs_script: | ssh -tt localhost "make -C /home/runc localintegration" integration_systemd_rootless_script: | - echo "SKIP: integration_systemd_rootless_script requires cgroup v2" + case $DISTRO in + centos-7|centos-stream-8) + echo "SKIP: integration_systemd_rootless_script requires cgroup v2" + ;; + *) + ssh -tt localhost "make -C /home/runc localrootlessintegration RUNC_USE_SYSTEMD=yes" + esac integration_fs_rootless_script: | case $DISTRO in centos-7) echo "SKIP: FIXME: integration_fs_rootless_script is skipped because of EPERM on writing cgroup.procs" ;; - centos-stream-8) + *) ssh -tt localhost "make -C /home/runc localrootlessintegration" ;; esac