decrease log level of cgroup2 ToggleController error when running in UserNS

Fix #4312

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2020-06-24 18:02:27 +09:00
parent c2f8011ff8
commit fd99b6566b
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A

View File

@ -46,6 +46,7 @@ import (
"github.com/containerd/containerd/runtime/v2/runc/options" "github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/containerd/containerd/runtime/v2/shim" "github.com/containerd/containerd/runtime/v2/shim"
taskAPI "github.com/containerd/containerd/runtime/v2/task" taskAPI "github.com/containerd/containerd/runtime/v2/task"
"github.com/containerd/containerd/sys"
"github.com/containerd/containerd/sys/reaper" "github.com/containerd/containerd/sys/reaper"
runcC "github.com/containerd/go-runc" runcC "github.com/containerd/go-runc"
"github.com/containerd/typeurl" "github.com/containerd/typeurl"
@ -360,9 +361,13 @@ func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI.
logrus.WithError(err).Error("failed to get root controllers") logrus.WithError(err).Error("failed to get root controllers")
} else { } else {
if err := cg.ToggleControllers(allControllers, cgroupsv2.Enable); err != nil { if err := cg.ToggleControllers(allControllers, cgroupsv2.Enable); err != nil {
if sys.RunningInUserNS() {
logrus.WithError(err).Debugf("failed to enable controllers (%v)", allControllers)
} else {
logrus.WithError(err).Errorf("failed to enable controllers (%v)", allControllers) logrus.WithError(err).Errorf("failed to enable controllers (%v)", allControllers)
} }
} }
}
if err := s.ep.Add(container.ID, cg); err != nil { if err := s.ep.Add(container.ID, cg); err != nil {
logrus.WithError(err).Error("add cg to OOM monitor") logrus.WithError(err).Error("add cg to OOM monitor")
} }