Warn if cgroups-v1

Podman v5 will not support cgroups-v1. This commit will print a warning
if it detects a cgroups-v1 system. The warning can be hidden by setting
envvar `PODMAN_CGROUPSV1_WARNING`.

This warning is patched out for RHEL 9 builds as cgroups-v1 will still
be supported on RHEL 9 systems.

Resolves: https://issues.redhat.com/browse/RUN-1957

[NO NEW TESTS NEEDED]

Co-authored-by: Ed Santiago <santiago@redhat.com>
Co-authored-by: Sascha Grunert <sgrunert@redhat.com>
Co-authored-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
Lokesh Mandvekar
2024-02-06 16:14:25 +05:30
parent a2f0a44501
commit 01a8539ef0
6 changed files with 28 additions and 1 deletions

View File

@ -393,6 +393,15 @@ func makeRuntime(runtime *Runtime) (retErr error) {
runtime.mergeDBConfig(dbConfig)
unified, _ := cgroups.IsCgroup2UnifiedMode()
// DELETE ON RHEL9
if !unified {
_, ok := os.LookupEnv("PODMAN_IGNORE_CGROUPSV1_WARNING")
if !ok {
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.")
}
}
// DELETE ON RHEL9
if unified && rootless.IsRootless() && !systemd.IsSystemdSessionValid(rootless.GetRootlessUID()) {
// If user is rootless and XDG_RUNTIME_DIR is found, podman will not proceed with /tmp directory
// it will try to use existing XDG_RUNTIME_DIR