Merge pull request #8143 from mxpv/log

Add Fields type alias to log package
This commit is contained in:
Fu Wei
2023-02-21 10:22:23 +08:00
committed by GitHub
21 changed files with 35 additions and 46 deletions

View File

@@ -363,7 +363,7 @@ func (b *snapshotter) Remove(ctx context.Context, key string) (err error) {
if restore { // means failed to commit transaction
// Attempt to restore source
if err1 := btrfs.SubvolSnapshot(source, removed, readonly); err1 != nil {
log.G(ctx).WithFields(logrus.Fields{
log.G(ctx).WithFields(log.Fields{
logrus.ErrorKey: err1,
"subvolume": source,
"renamed": removed,

View File

@@ -34,7 +34,6 @@ import (
"github.com/containerd/containerd/snapshots/devmapper/dmsetup"
"github.com/containerd/containerd/snapshots/storage"
"github.com/hashicorp/go-multierror"
"github.com/sirupsen/logrus"
exec "golang.org/x/sys/execabs"
)
@@ -201,7 +200,7 @@ func (s *Snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, er
// Prepare creates thin device for an active snapshot identified by key
func (s *Snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
log.G(ctx).WithFields(logrus.Fields{"key": key, "parent": parent}).Debug("prepare")
log.G(ctx).WithFields(log.Fields{"key": key, "parent": parent}).Debug("prepare")
var (
mounts []mount.Mount
@@ -218,7 +217,7 @@ func (s *Snapshotter) Prepare(ctx context.Context, key, parent string, opts ...s
// View creates readonly thin device for the given snapshot key
func (s *Snapshotter) View(ctx context.Context, key, parent string, opts ...snapshots.Opt) ([]mount.Mount, error) {
log.G(ctx).WithFields(logrus.Fields{"key": key, "parent": parent}).Debug("view")
log.G(ctx).WithFields(log.Fields{"key": key, "parent": parent}).Debug("view")
var (
mounts []mount.Mount
@@ -237,7 +236,7 @@ func (s *Snapshotter) View(ctx context.Context, key, parent string, opts ...snap
// Block device unmount operation captures snapshot changes by itself, so no
// additional actions needed within Commit operation.
func (s *Snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) error {
log.G(ctx).WithFields(logrus.Fields{"name": name, "key": key}).Debug("commit")
log.G(ctx).WithFields(log.Fields{"name": name, "key": key}).Debug("commit")
return s.store.WithTransaction(ctx, true, func(ctx context.Context) error {
id, snapInfo, _, err := storage.GetInfo(ctx, key)