mirror of
https://github.com/systemd/systemd.git
synced 2026-08-02 22:20:20 +00:00
nspawn: drop cgv1 handling; core: drop cgroup agent (#36764)
This commit is contained in:
@@ -49,15 +49,6 @@ at_exit() {
|
||||
|
||||
trap at_exit EXIT
|
||||
|
||||
# check cgroup-v2
|
||||
IS_CGROUPSV2_SUPPORTED=no
|
||||
mkdir -p /tmp/cgroup2
|
||||
if mount -t cgroup2 cgroup2 /tmp/cgroup2; then
|
||||
IS_CGROUPSV2_SUPPORTED=yes
|
||||
umount /tmp/cgroup2
|
||||
fi
|
||||
rmdir /tmp/cgroup2
|
||||
|
||||
# check cgroup namespaces
|
||||
IS_CGNS_SUPPORTED=no
|
||||
if [[ -f /proc/1/ns/cgroup ]]; then
|
||||
@@ -880,36 +871,30 @@ EOF
|
||||
}
|
||||
|
||||
matrix_run_one() {
|
||||
local cgroupsv2="${1:?}"
|
||||
local use_cgns="${2:?}"
|
||||
local api_vfs_writable="${3:?}"
|
||||
local use_cgns="${1:?}"
|
||||
local api_vfs_writable="${2:?}"
|
||||
local root
|
||||
|
||||
if [[ "$cgroupsv2" == "yes" && "$IS_CGROUPSV2_SUPPORTED" == "no" ]]; then
|
||||
echo >&2 "Unified cgroup hierarchy is not supported, skipping..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [[ "$use_cgns" == "yes" && "$IS_CGNS_SUPPORTED" == "no" ]]; then
|
||||
echo >&2 "CGroup namespaces are not supported, skipping..."
|
||||
return 0
|
||||
fi
|
||||
|
||||
root="$(mktemp -d "/var/lib/machines/TEST-13-NSPAWN.unified-$1-cgns-$2-api-vfs-writable-$3.XXX")"
|
||||
root="$(mktemp -d "/var/lib/machines/TEST-13-NSPAWN.cgns-$1-api-vfs-writable-$2.XXX")"
|
||||
create_dummy_container "$root"
|
||||
|
||||
SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$cgroupsv2" SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
systemd-nspawn --register=no \
|
||||
--directory="$root" \
|
||||
--boot
|
||||
|
||||
SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$cgroupsv2" SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
systemd-nspawn --register=no \
|
||||
--directory="$root" \
|
||||
--private-network \
|
||||
--boot
|
||||
|
||||
if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$cgroupsv2" SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
if SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
systemd-nspawn --register=no \
|
||||
--directory="$root" \
|
||||
--private-users=pick \
|
||||
@@ -919,7 +904,7 @@ matrix_run_one() {
|
||||
[[ "$IS_USERNS_SUPPORTED" == "no" && "$api_vfs_writable" == "network" ]] && return 1
|
||||
fi
|
||||
|
||||
if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$cgroupsv2" SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
if SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
systemd-nspawn --register=no \
|
||||
--directory="$root" \
|
||||
--private-network \
|
||||
@@ -945,7 +930,7 @@ matrix_run_one() {
|
||||
# --network-namespace-path and network-related options cannot be used together
|
||||
for net_opt in "${net_opts[@]}"; do
|
||||
echo "$netns_opt in combination with $net_opt should fail"
|
||||
if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$cgroupsv2" SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
if SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
systemd-nspawn --register=no \
|
||||
--directory="$root" \
|
||||
--boot \
|
||||
@@ -957,7 +942,7 @@ matrix_run_one() {
|
||||
done
|
||||
|
||||
# allow combination of --network-namespace-path and --private-network
|
||||
SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$cgroupsv2" SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
systemd-nspawn --register=no \
|
||||
--directory="$root" \
|
||||
--boot \
|
||||
@@ -967,7 +952,7 @@ matrix_run_one() {
|
||||
# test --network-namespace-path works with a network namespace created by "ip netns"
|
||||
ip netns add nspawn_test
|
||||
netns_opt="--network-namespace-path=/run/netns/nspawn_test"
|
||||
SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$cgroupsv2" SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
SYSTEMD_NSPAWN_USE_CGNS="$use_cgns" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$api_vfs_writable" \
|
||||
systemd-nspawn --register=no \
|
||||
--directory="$root" \
|
||||
--network-namespace-path=/run/netns/nspawn_test \
|
||||
@@ -983,10 +968,8 @@ testcase_api_vfs() {
|
||||
local api_vfs_writable
|
||||
|
||||
for api_vfs_writable in yes no network; do
|
||||
matrix_run_one no no $api_vfs_writable
|
||||
matrix_run_one yes no $api_vfs_writable
|
||||
matrix_run_one no yes $api_vfs_writable
|
||||
matrix_run_one yes yes $api_vfs_writable
|
||||
matrix_run_one no $api_vfs_writable
|
||||
matrix_run_one yes $api_vfs_writable
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user