Cleanup logrus imports
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
@@ -32,13 +32,13 @@ import (
|
||||
"github.com/containerd/console"
|
||||
"github.com/containerd/containerd/api/runtime/task/v2"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/mount"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/containerd/containerd/pkg/process"
|
||||
"github.com/containerd/containerd/pkg/stdio"
|
||||
"github.com/containerd/containerd/runtime/v2/runc/options"
|
||||
"github.com/containerd/typeurl/v2"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// NewContainer returns a new runc container
|
||||
@@ -111,7 +111,7 @@ func NewContainer(ctx context.Context, platform stdio.Platform, r *task.CreateTa
|
||||
defer func() {
|
||||
if retErr != nil {
|
||||
if err := mount.UnmountMounts(mounts, rootfs, 0); err != nil {
|
||||
logrus.WithError(err).Warn("failed to cleanup rootfs mount")
|
||||
log.G(ctx).WithError(err).Warn("failed to cleanup rootfs mount")
|
||||
}
|
||||
}
|
||||
}()
|
||||
@@ -148,17 +148,17 @@ func NewContainer(ctx context.Context, platform stdio.Platform, r *task.CreateTa
|
||||
if cgroups.Mode() == cgroups.Unified {
|
||||
g, err := cgroupsv2.PidGroupPath(pid)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("loading cgroup2 for %d", pid)
|
||||
log.G(ctx).WithError(err).Errorf("loading cgroup2 for %d", pid)
|
||||
return container, nil
|
||||
}
|
||||
cg, err = cgroupsv2.Load(g)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("loading cgroup2 for %d", pid)
|
||||
log.G(ctx).WithError(err).Errorf("loading cgroup2 for %d", pid)
|
||||
}
|
||||
} else {
|
||||
cg, err = cgroup1.Load(cgroup1.PidPath(pid))
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("loading cgroup for %d", pid)
|
||||
log.G(ctx).WithError(err).Errorf("loading cgroup for %d", pid)
|
||||
}
|
||||
}
|
||||
container.cgroup = cg
|
||||
@@ -369,16 +369,16 @@ func (c *Container) Start(ctx context.Context, r *task.StartRequest) (process.Pr
|
||||
if cgroups.Mode() == cgroups.Unified {
|
||||
g, err := cgroupsv2.PidGroupPath(p.Pid())
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("loading cgroup2 for %d", p.Pid())
|
||||
log.G(ctx).WithError(err).Errorf("loading cgroup2 for %d", p.Pid())
|
||||
}
|
||||
cg, err = cgroupsv2.Load(g)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("loading cgroup2 for %d", p.Pid())
|
||||
log.G(ctx).WithError(err).Errorf("loading cgroup2 for %d", p.Pid())
|
||||
}
|
||||
} else {
|
||||
cg, err = cgroup1.Load(cgroup1.PidPath(p.Pid()))
|
||||
if err != nil {
|
||||
logrus.WithError(err).Errorf("loading cgroup for %d", p.Pid())
|
||||
log.G(ctx).WithError(err).Errorf("loading cgroup for %d", p.Pid())
|
||||
}
|
||||
}
|
||||
c.cgroup = cg
|
||||
|
||||
@@ -23,9 +23,9 @@ import (
|
||||
"runtime"
|
||||
|
||||
"github.com/containerd/containerd/api/types"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/pkg/shutdown"
|
||||
"github.com/containerd/ttrpc"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
api "github.com/containerd/containerd/api/runtime/sandbox/v1"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
@@ -64,17 +64,17 @@ func (p *pauseService) RegisterTTRPC(server *ttrpc.Server) error {
|
||||
}
|
||||
|
||||
func (p *pauseService) CreateSandbox(ctx context.Context, req *api.CreateSandboxRequest) (*api.CreateSandboxResponse, error) {
|
||||
log.Debugf("create sandbox request: %+v", req)
|
||||
log.G(ctx).Debugf("create sandbox request: %+v", req)
|
||||
return &api.CreateSandboxResponse{}, nil
|
||||
}
|
||||
|
||||
func (p *pauseService) StartSandbox(ctx context.Context, req *api.StartSandboxRequest) (*api.StartSandboxResponse, error) {
|
||||
log.Debugf("start sandbox request: %+v", req)
|
||||
log.G(ctx).Debugf("start sandbox request: %+v", req)
|
||||
return &api.StartSandboxResponse{}, nil
|
||||
}
|
||||
|
||||
func (p *pauseService) Platform(ctx context.Context, req *api.PlatformRequest) (*api.PlatformResponse, error) {
|
||||
log.Debugf("platform request: %+v", req)
|
||||
log.G(ctx).Debugf("platform request: %+v", req)
|
||||
|
||||
platform := types.Platform{
|
||||
OS: runtime.GOOS,
|
||||
@@ -85,7 +85,7 @@ func (p *pauseService) Platform(ctx context.Context, req *api.PlatformRequest) (
|
||||
}
|
||||
|
||||
func (p *pauseService) StopSandbox(ctx context.Context, req *api.StopSandboxRequest) (*api.StopSandboxResponse, error) {
|
||||
log.Debugf("stop sandbox request: %+v", req)
|
||||
log.G(ctx).Debugf("stop sandbox request: %+v", req)
|
||||
p.shutdown.Shutdown()
|
||||
return &api.StopSandboxResponse{}, nil
|
||||
}
|
||||
@@ -97,7 +97,7 @@ func (p *pauseService) WaitSandbox(ctx context.Context, req *api.WaitSandboxRequ
|
||||
}
|
||||
|
||||
func (p *pauseService) SandboxStatus(ctx context.Context, req *api.SandboxStatusRequest) (*api.SandboxStatusResponse, error) {
|
||||
log.Debugf("sandbox status request: %+v", req)
|
||||
log.G(ctx).Debugf("sandbox status request: %+v", req)
|
||||
return &api.SandboxStatusResponse{}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import (
|
||||
taskAPI "github.com/containerd/containerd/api/runtime/task/v2"
|
||||
"github.com/containerd/containerd/api/types/task"
|
||||
"github.com/containerd/containerd/errdefs"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/namespaces"
|
||||
"github.com/containerd/containerd/pkg/oom"
|
||||
oomv1 "github.com/containerd/containerd/pkg/oom/v1"
|
||||
@@ -48,7 +49,6 @@ import (
|
||||
runcC "github.com/containerd/go-runc"
|
||||
"github.com/containerd/ttrpc"
|
||||
"github.com/containerd/typeurl/v2"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -170,23 +170,23 @@ func (s *service) Start(ctx context.Context, r *taskAPI.StartRequest) (*taskAPI.
|
||||
switch cg := container.Cgroup().(type) {
|
||||
case cgroup1.Cgroup:
|
||||
if err := s.ep.Add(container.ID, cg); err != nil {
|
||||
logrus.WithError(err).Error("add cg to OOM monitor")
|
||||
log.G(ctx).WithError(err).Error("add cg to OOM monitor")
|
||||
}
|
||||
case *cgroupsv2.Manager:
|
||||
allControllers, err := cg.RootControllers()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("failed to get root controllers")
|
||||
log.G(ctx).WithError(err).Error("failed to get root controllers")
|
||||
} else {
|
||||
if err := cg.ToggleControllers(allControllers, cgroupsv2.Enable); err != nil {
|
||||
if userns.RunningInUserNS() {
|
||||
logrus.WithError(err).Debugf("failed to enable controllers (%v)", allControllers)
|
||||
log.G(ctx).WithError(err).Debugf("failed to enable controllers (%v)", allControllers)
|
||||
} else {
|
||||
logrus.WithError(err).Errorf("failed to enable controllers (%v)", allControllers)
|
||||
log.G(ctx).WithError(err).Errorf("failed to enable controllers (%v)", allControllers)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := s.ep.Add(container.ID, cg); err != nil {
|
||||
logrus.WithError(err).Error("add cg to OOM monitor")
|
||||
log.G(ctx).WithError(err).Error("add cg to OOM monitor")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ func (s *service) checkProcesses(e runcC.Exit) {
|
||||
// Ensure all children are killed
|
||||
if runc.ShouldKillAllOnExit(s.context, container.Bundle) {
|
||||
if err := ip.KillAll(s.context); err != nil {
|
||||
logrus.WithError(err).WithField("id", ip.ID()).
|
||||
log.L.WithError(err).WithField("id", ip.ID()).
|
||||
Error("failed to kill init's children")
|
||||
}
|
||||
}
|
||||
@@ -587,7 +587,7 @@ func (s *service) forward(ctx context.Context, publisher shim.Publisher) {
|
||||
for e := range s.events {
|
||||
err := publisher.Publish(ctx, runc.GetTopic(e), e)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error("post event")
|
||||
log.G(ctx).WithError(err).Error("post event")
|
||||
}
|
||||
}
|
||||
publisher.Close()
|
||||
|
||||
Reference in New Issue
Block a user