libpod/runtime.go: Remove Cgroups v1

Signed-off-by: Lokesh Mandvekar <lsm5@redhat.com>
This commit is contained in:
Lokesh Mandvekar
2025-11-05 09:20:10 -05:00
parent faa551a921
commit a12b3e97d2

View File

@@ -34,7 +34,6 @@ import (
"go.podman.io/common/libimage" "go.podman.io/common/libimage"
"go.podman.io/common/libnetwork/network" "go.podman.io/common/libnetwork/network"
nettypes "go.podman.io/common/libnetwork/types" nettypes "go.podman.io/common/libnetwork/types"
"go.podman.io/common/pkg/cgroups"
"go.podman.io/common/pkg/config" "go.podman.io/common/pkg/config"
artStore "go.podman.io/common/pkg/libartifact/store" artStore "go.podman.io/common/pkg/libartifact/store"
"go.podman.io/common/pkg/secrets" "go.podman.io/common/pkg/secrets"
@@ -179,11 +178,7 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
runtime := new(Runtime) runtime := new(Runtime)
if conf.Engine.OCIRuntime == "" { if conf.Engine.OCIRuntime == "" {
conf.Engine.OCIRuntime = "runc" conf.Engine.OCIRuntime = "crun"
// If we're running on cgroups v2, default to using crun.
if onCgroupsv2, _ := cgroups.IsCgroup2UnifiedMode(); onCgroupsv2 {
conf.Engine.OCIRuntime = "crun"
}
} }
runtime.config = conf runtime.config = conf
@@ -543,8 +538,7 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
// and no valid systemd session is present // and no valid systemd session is present
// warn only whenever new namespace is created // warn only whenever new namespace is created
if runtime.config.Engine.CgroupManager == config.SystemdCgroupsManager { if runtime.config.Engine.CgroupManager == config.SystemdCgroupsManager {
unified, _ := cgroups.IsCgroup2UnifiedMode() if rootless.IsRootless() && !systemd.IsSystemdSessionValid(rootless.GetRootlessUID()) {
if unified && rootless.IsRootless() && !systemd.IsSystemdSessionValid(rootless.GetRootlessUID()) {
logrus.Debug("Invalid systemd user session for current user") logrus.Debug("Invalid systemd user session for current user")
} }
} }