Skip to content

Commit 8abd12c

Browse files
authored
Merge pull request moby#52018 from thaJeztah/volumes_notfound
daemon/volume: don't print warnings for non-volume directories
2 parents 333b8b6 + 7fef0b6 commit 8abd12c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

daemon/volume/local/local.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func New(scope string, rootIdentity idtools.Identity) (*Root, error) {
7373
}
7474

7575
for _, d := range dirs {
76+
// TODO(thaJeztah): this should probably skip non-volume directories (directories without a "_data" directory and no "opts.json" file).
7677
if !d.IsDir() {
7778
continue
7879
}

daemon/volume/service/convert.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package service
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
7+
"os"
68
"strconv"
79
"time"
810

@@ -69,7 +71,12 @@ func (s *VolumesService) volumesToAPI(ctx context.Context, volumes []volume.Volu
6971
}
7072
sz, err := directory.Size(ctx, p)
7173
if err != nil {
72-
log.G(ctx).WithError(err).WithField("volume", v.Name()).Warnf("Failed to determine size of volume")
74+
if !errors.Is(err, os.ErrNotExist) {
75+
log.G(ctx).WithFields(log.Fields{
76+
"error": err,
77+
"volume": v.Name(),
78+
}).Warn("Failed to determine size of volume")
79+
}
7380
sz = -1
7481
}
7582
apiV.UsageData = &volumetypes.UsageData{Size: sz, RefCount: int64(s.vs.CountReferences(v))}

0 commit comments

Comments
 (0)