Update snapshot and content related log messages

Make the tense and casing consistent.
Add useful log messages in image service.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-12-01 14:57:34 -08:00
parent f6df9f6632
commit b28d7cdf1b
9 changed files with 36 additions and 32 deletions

View File

@@ -141,6 +141,7 @@ func (s *service) List(req *api.ListContentRequest, session api.Content_ListServ
}
func (s *service) Delete(ctx context.Context, req *api.DeleteContentRequest) (*ptypes.Empty, error) {
log.G(ctx).WithField("digest", req.Digest).Debugf("delete content")
if err := req.Digest.Validate(); err != nil {
return nil, status.Errorf(codes.InvalidArgument, err.Error())
}

View File

@@ -9,6 +9,7 @@ import (
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/events"
"github.com/containerd/containerd/images"
"github.com/containerd/containerd/log"
"github.com/containerd/containerd/metadata"
"github.com/containerd/containerd/plugin"
ptypes "github.com/gogo/protobuf/types"
@@ -94,6 +95,7 @@ func (s *service) List(ctx context.Context, req *imagesapi.ListImagesRequest) (*
}
func (s *service) Create(ctx context.Context, req *imagesapi.CreateImageRequest) (*imagesapi.CreateImageResponse, error) {
log.G(ctx).WithField("name", req.Image.Name).WithField("target", req.Image.Target.Digest).Debugf("create image")
if req.Image.Name == "" {
return nil, status.Errorf(codes.InvalidArgument, "Image.Name required")
}
@@ -164,6 +166,7 @@ func (s *service) Update(ctx context.Context, req *imagesapi.UpdateImageRequest)
}
func (s *service) Delete(ctx context.Context, req *imagesapi.DeleteImageRequest) (*ptypes.Empty, error) {
log.G(ctx).WithField("name", req.Name).Debugf("delete image")
if err := s.withStoreUpdate(ctx, func(ctx context.Context, store images.Store) error {
return errdefs.ToGRPC(store.Delete(ctx, req.Name))
}); err != nil {

View File

@@ -66,7 +66,7 @@ func (s *service) Register(gs *grpc.Server) error {
}
func (s *service) Prepare(ctx context.Context, pr *snapshotsapi.PrepareSnapshotRequest) (*snapshotsapi.PrepareSnapshotResponse, error) {
log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("Preparing snapshot")
log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("prepare snapshot")
sn, err := s.getSnapshotter(pr.Snapshotter)
if err != nil {
return nil, err
@@ -93,7 +93,7 @@ func (s *service) Prepare(ctx context.Context, pr *snapshotsapi.PrepareSnapshotR
}
func (s *service) View(ctx context.Context, pr *snapshotsapi.ViewSnapshotRequest) (*snapshotsapi.ViewSnapshotResponse, error) {
log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("Preparing view snapshot")
log.G(ctx).WithField("parent", pr.Parent).WithField("key", pr.Key).Debugf("prepare view snapshot")
sn, err := s.getSnapshotter(pr.Snapshotter)
if err != nil {
return nil, err
@@ -112,7 +112,7 @@ func (s *service) View(ctx context.Context, pr *snapshotsapi.ViewSnapshotRequest
}
func (s *service) Mounts(ctx context.Context, mr *snapshotsapi.MountsRequest) (*snapshotsapi.MountsResponse, error) {
log.G(ctx).WithField("key", mr.Key).Debugf("Getting snapshot mounts")
log.G(ctx).WithField("key", mr.Key).Debugf("get snapshot mounts")
sn, err := s.getSnapshotter(mr.Snapshotter)
if err != nil {
return nil, err
@@ -128,7 +128,7 @@ func (s *service) Mounts(ctx context.Context, mr *snapshotsapi.MountsRequest) (*
}
func (s *service) Commit(ctx context.Context, cr *snapshotsapi.CommitSnapshotRequest) (*ptypes.Empty, error) {
log.G(ctx).WithField("key", cr.Key).WithField("name", cr.Name).Debugf("Committing snapshot")
log.G(ctx).WithField("key", cr.Key).WithField("name", cr.Name).Debugf("commit snapshot")
sn, err := s.getSnapshotter(cr.Snapshotter)
if err != nil {
return nil, err
@@ -152,7 +152,7 @@ func (s *service) Commit(ctx context.Context, cr *snapshotsapi.CommitSnapshotReq
}
func (s *service) Remove(ctx context.Context, rr *snapshotsapi.RemoveSnapshotRequest) (*ptypes.Empty, error) {
log.G(ctx).WithField("key", rr.Key).Debugf("Removing snapshot")
log.G(ctx).WithField("key", rr.Key).Debugf("remove snapshot")
sn, err := s.getSnapshotter(rr.Snapshotter)
if err != nil {
return nil, err
@@ -171,7 +171,7 @@ func (s *service) Remove(ctx context.Context, rr *snapshotsapi.RemoveSnapshotReq
}
func (s *service) Stat(ctx context.Context, sr *snapshotsapi.StatSnapshotRequest) (*snapshotsapi.StatSnapshotResponse, error) {
log.G(ctx).WithField("key", sr.Key).Debugf("Statting snapshot")
log.G(ctx).WithField("key", sr.Key).Debugf("stat snapshot")
sn, err := s.getSnapshotter(sr.Snapshotter)
if err != nil {
return nil, err
@@ -186,7 +186,7 @@ func (s *service) Stat(ctx context.Context, sr *snapshotsapi.StatSnapshotRequest
}
func (s *service) Update(ctx context.Context, sr *snapshotsapi.UpdateSnapshotRequest) (*snapshotsapi.UpdateSnapshotResponse, error) {
log.G(ctx).WithField("key", sr.Info.Name).Debugf("Updating snapshot")
log.G(ctx).WithField("key", sr.Info.Name).Debugf("update snapshot")
sn, err := s.getSnapshotter(sr.Snapshotter)
if err != nil {
return nil, err