Skip to content

Commit f439f4e

Browse files
Merge pull request #21431 from lsm5/cgroupv1-warn
Warn if cgroups-v1
2 parents a2f0a44 + 01a8539 commit f439f4e

File tree

6 files changed

+28
-1
lines changed

6 files changed

+28
-1
lines changed

.cirrus.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ build_task:
123123
DISTRO_NV: ${DEBIAN_NAME}
124124
VM_IMAGE_NAME: ${DEBIAN_CACHE_IMAGE_NAME}
125125
CI_DESIRED_RUNTIME: runc
126+
CI_DESIRED_NETWORK: netavark
127+
# Ignore cgroups-v1 warnings on debian
128+
PODMAN_IGNORE_CGROUPSV1_WARNING: true
126129
env:
127130
TEST_FLAVOR: build
128131
# NOTE: The default way Cirrus-CI clones is *NOT* compatible with

contrib/cirrus/lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ EPOCH_TEST_COMMIT="$CIRRUS_BASE_SHA"
9595
# contexts, such as host->container or root->rootless user
9696
#
9797
# List of envariables which must be EXACT matches
98-
PASSTHROUGH_ENV_EXACT='CGROUP_MANAGER|DEST_BRANCH|DISTRO_NV|GOCACHE|GOPATH|GOSRC|OCI_RUNTIME|ROOTLESS_USER|SCRIPT_BASE|SKIP_USERNS|EC2_INST_TYPE|PODMAN_DB|STORAGE_FS'
98+
PASSTHROUGH_ENV_EXACT='CGROUP_MANAGER|DEST_BRANCH|DISTRO_NV|GOCACHE|GOPATH|GOSRC|NETWORK_BACKEND|OCI_RUNTIME|PODMAN_IGNORE_CGROUPSV1_WARNING|ROOTLESS_USER|SCRIPT_BASE|SKIP_USERNS|EC2_INST_TYPE|PODMAN_DB|STORAGE_FS'
9999

100100
# List of envariable patterns which must match AT THE BEGINNING of the name.
101101
PASSTHROUGH_ENV_ATSTART='CI|LANG|LC_|TEST'

libpod/runtime.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,15 @@ func makeRuntime(runtime *Runtime) (retErr error) {
393393
runtime.mergeDBConfig(dbConfig)
394394

395395
unified, _ := cgroups.IsCgroup2UnifiedMode()
396+
// DELETE ON RHEL9
397+
if !unified {
398+
_, ok := os.LookupEnv("PODMAN_IGNORE_CGROUPSV1_WARNING")
399+
if !ok {
400+
logrus.Warn("Using cgroups-v1 which is deprecated in favor of cgroups-v2 with Podman v5 and will be removed in a future version. Set environment variable `PODMAN_IGNORE_CGROUPSV1_WARNING` to hide this warning.")
401+
}
402+
}
403+
// DELETE ON RHEL9
404+
396405
if unified && rootless.IsRootless() && !systemd.IsSystemdSessionValid(rootless.GetRootlessUID()) {
397406
// If user is rootless and XDG_RUNTIME_DIR is found, podman will not proceed with /tmp directory
398407
// it will try to use existing XDG_RUNTIME_DIR

rpm/podman.spec

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ when `%{_bindir}/%{name}sh` is set as a login shell or set as os.Args[0].
211211
%autosetup -Sgit -n %{name}-%{version_no_tilde}
212212
sed -i 's;@@PODMAN@@\;$(BINDIR);@@PODMAN@@\;%{_bindir};' Makefile
213213

214+
# cgroups-v1 is supported on rhel9
215+
%if 0%{?rhel} == 9
216+
sed -i '/DELETE ON RHEL9/,/DELETE ON RHEL9/d' libpod/runtime.go
217+
%endif
218+
214219
# These changes are only meant for copr builds
215220
%if %{defined copr_build}
216221
# podman --version should show short sha

test/system/120-load.bats

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ verify_iid_and_name() {
8888
skip "impossible due to pitfalls in our SSH implementation"
8989
fi
9090

91+
# See https://github.com/containers/podman/pull/21431
92+
if [[ -n "$PODMAN_IGNORE_CGROUPSV1_WARNING" ]]; then
93+
skip "impossible to test due to pitfalls in our SSH implementation"
94+
fi
95+
9196
# The testing is the same whether we're root or rootless; all that
9297
# differs is the destination (not-me) username.
9398
if is_rootless; then

test/system/252-quadlet.bats

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ Notify=yes
153153
LogDriver=passthrough
154154
EOF
155155

156+
# FIXME: Temporary until podman fully removes cgroupsv1 support; see #21431
157+
if [[ -n "$PODMAN_IGNORE_CGROUPSV1_WARNING" ]]; then
158+
skip "Way too complicated to test under cgroupsv1, and not worth the effort"
159+
fi
160+
156161
run_quadlet "$quadlet_file"
157162
service_setup $QUADLET_SERVICE_NAME
158163

0 commit comments

Comments
 (0)