aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2021-09-20 09:35:24 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2021-09-20 09:38:24 +0200
commit4caca0969863f5b8d13ff377ed1cc24d4033ed1a (patch)
treec5221ca3aa9df7911e106c781dc5e542a2701a25 /utils
parentddb384451147c4ef9d0307be0cc8dbad6d94970c (diff)
downloadpodman-4caca0969863f5b8d13ff377ed1cc24d4033ed1a.tar.gz
podman-4caca0969863f5b8d13ff377ed1cc24d4033ed1a.tar.bz2
podman-4caca0969863f5b8d13ff377ed1cc24d4033ed1a.zip
utils: raise warning only on cgroupv2
if it is not running on cgroup v2, print only a debug message since rootless users cannot create the cgroup. commit 9c1e27fdd536f6026efe3da4360755a3e9135ca8 introduced the regression. [NO TESTS NEEDED] Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/utils/utils.go b/utils/utils.go
index 185ac4865..b08630d2f 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -12,6 +12,7 @@ import (
"sync"
"github.com/containers/podman/v3/libpod/define"
+ "github.com/containers/podman/v3/pkg/cgroups"
"github.com/containers/storage/pkg/archive"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -190,7 +191,11 @@ func moveProcessToScope(pidPath, slice, scope string) error {
func MovePauseProcessToScope(pausePidPath string) {
err := moveProcessToScope(pausePidPath, "user.slice", "podman-pause.scope")
if err != nil {
- if RunsOnSystemd() {
+ unified, err := cgroups.IsCgroup2UnifiedMode()
+ if err != nil {
+ logrus.Warnf("Failed to detect if running with cgroup unified: %v", err)
+ }
+ if RunsOnSystemd() && unified {
logrus.Warnf("Failed to add pause process to systemd sandbox cgroup: %v", err)
} else {
logrus.Debugf("Failed to add pause process to systemd sandbox cgroup: %v", err)