Skip to content

Commit

Permalink
utils: raise warning only on cgroupv2
Browse files Browse the repository at this point in the history
if it is not running on cgroup v2, print only a debug message since
rootless users cannot create the cgroup.

commit 9c1e27f introduced the regression.

[NO TESTS NEEDED]

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Sep 20, 2021
1 parent ddb3844 commit 4caca09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4caca09

Please sign in to comment.