bugfix: updatedAt timestamp file may be empty

Signed-off-by: Michael Wan <zirenwan@gmail.com>
This commit is contained in:
Michael Wan
2018-08-29 07:32:01 -04:00
parent 93d3f065ac
commit 92243ff72a
5 changed files with 32 additions and 6 deletions

View File

@@ -33,6 +33,7 @@ import (
"github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/snapshots/storage"
"github.com/containerd/continuity/fs"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -171,7 +172,7 @@ func (b *snapshotter) usage(ctx context.Context, key string) (snapshots.Usage, e
if parentID != "" {
du, err = fs.DiffUsage(ctx, filepath.Join(b.root, "snapshots", parentID), p)
} else {
du, err = fs.DiskUsage(p)
du, err = fs.DiskUsage(ctx, p)
}
if err != nil {
// TODO(stevvooe): Consider not reporting an error in this case.

View File

@@ -28,6 +28,7 @@ import (
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/snapshots"
"github.com/containerd/containerd/snapshots/storage"
"github.com/containerd/continuity/fs"
"github.com/pkg/errors"
)
@@ -120,7 +121,7 @@ func (o *snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, e
}
if info.Kind == snapshots.KindActive {
du, err := fs.DiskUsage(o.getSnapshotDir(id))
du, err := fs.DiskUsage(ctx, o.getSnapshotDir(id))
if err != nil {
return snapshots.Usage{}, err
}
@@ -166,7 +167,7 @@ func (o *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
return err
}
usage, err := fs.DiskUsage(o.getSnapshotDir(id))
usage, err := fs.DiskUsage(ctx, o.getSnapshotDir(id))
if err != nil {
return err
}

View File

@@ -168,7 +168,7 @@ func (o *snapshotter) Usage(ctx context.Context, key string) (snapshots.Usage, e
upperPath := o.upperPath(id)
if info.Kind == snapshots.KindActive {
du, err := fs.DiskUsage(upperPath)
du, err := fs.DiskUsage(ctx, upperPath)
if err != nil {
// TODO(stevvooe): Consider not reporting an error in this case.
return snapshots.Usage{}, err
@@ -225,7 +225,7 @@ func (o *snapshotter) Commit(ctx context.Context, name, key string, opts ...snap
return err
}
usage, err := fs.DiskUsage(o.upperPath(id))
usage, err := fs.DiskUsage(ctx, o.upperPath(id))
if err != nil {
return err
}