1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-09-13 05:44:54 +03:00

tests: introduce UNIFIED_CGROUP_HIERARCHY (#3419)

There are many cgroups-related changes (thanks, @htejun!)
This commit will simplify testing a bit.

Use:
make run UNIFIED_CGROUP_HIERARCHY=yes to enable cgroup-v2
make run UNIFIED_CGROUP_HIERARCHY=no to enable cgroup-v1
This commit is contained in:
Evgeny Vereshchagin
2016-06-03 12:17:00 +03:00
committed by Lennart Poettering
parent d2bc125132
commit 856ca72b29
2 changed files with 6 additions and 1 deletions

2
NEWS
View File

@@ -916,7 +916,7 @@ CHANGES WITH 226:
available, systemd will fall back to the legacy cgroup available, systemd will fall back to the legacy cgroup
hierarchy setup, as before. Host system and containers can hierarchy setup, as before. Host system and containers can
mix and match legacy and unified hierarchies as they mix and match legacy and unified hierarchies as they
wish. nspawn understands the $UNIFIED_CROUP_HIERARCHY wish. nspawn understands the $UNIFIED_CGROUP_HIERARCHY
environment variable to individually select the hierarchy to environment variable to individually select the hierarchy to
use for executed containers. By default, nspawn will use the use for executed containers. By default, nspawn will use the
unified hierarchy for the containers if the host uses the unified hierarchy for the containers if the host uses the

View File

@@ -10,6 +10,7 @@ KERNEL_MODS="/lib/modules/$KERNEL_VER/"
QEMU_TIMEOUT="${QEMU_TIMEOUT:-infinity}" QEMU_TIMEOUT="${QEMU_TIMEOUT:-infinity}"
NSPAWN_TIMEOUT="${NSPAWN_TIMEOUT:-infinity}" NSPAWN_TIMEOUT="${NSPAWN_TIMEOUT:-infinity}"
FSTYPE="${FSTYPE:-ext3}" FSTYPE="${FSTYPE:-ext3}"
UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-no}"
if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then if ! ROOTLIBDIR=$(pkg-config --variable=systemdutildir systemd); then
echo "WARNING! Cannot determine rootlibdir from pkg-config, assuming /usr/lib/systemd" >&2 echo "WARNING! Cannot determine rootlibdir from pkg-config, assuming /usr/lib/systemd" >&2
@@ -70,6 +71,7 @@ init=$ROOTLIBDIR/systemd \
ro \ ro \
console=ttyS0 \ console=ttyS0 \
selinux=0 \ selinux=0 \
systemd.unified_cgroup_hierarchy=$UNIFIED_CGROUP_HIERARCHY \
$KERNEL_APPEND \ $KERNEL_APPEND \
" "
@@ -101,6 +103,9 @@ run_nspawn() {
if [[ "$NSPAWN_TIMEOUT" != "infinity" ]]; then if [[ "$NSPAWN_TIMEOUT" != "infinity" ]]; then
_nspawn_cmd="timeout --foreground $NSPAWN_TIMEOUT $_nspawn_cmd" _nspawn_cmd="timeout --foreground $NSPAWN_TIMEOUT $_nspawn_cmd"
fi fi
_nspawn_cmd="env UNIFIED_CGROUP_HIERARCHY=$UNIFIED_CGROUP_HIERARCHY $_nspawn_cmd"
set -x set -x
$_nspawn_cmd $_nspawn_cmd
} }