1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Add more detailed logging to aufs init

Addresses some comments on 276b44608b

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff 2017-08-22 14:17:19 -04:00
parent bbcdc7df34
commit 0a98025d4b

View file

@ -141,19 +141,26 @@ func Init(root string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
return nil, err return nil, err
} }
} }
logger := logrus.WithFields(logrus.Fields{
"module": "graphdriver",
"driver": "aufs",
})
for _, path := range []string{"mnt", "diff"} { for _, path := range []string{"mnt", "diff"} {
p := filepath.Join(root, path) p := filepath.Join(root, path)
dirs, err := ioutil.ReadDir(p) entries, err := ioutil.ReadDir(p)
if err != nil { if err != nil {
logrus.WithError(err).WithField("dir", p).Error("error reading dir entries") logger.WithError(err).WithField("dir", p).Error("error reading dir entries")
continue continue
} }
for _, dir := range dirs { for _, entry := range entries {
if strings.HasSuffix(dir.Name(), "-removing") { if !entry.IsDir() {
logrus.WithField("dir", dir.Name()).Debug("Cleaning up stale layer dir") continue
if err := system.EnsureRemoveAll(filepath.Join(p, dir.Name())); err != nil { }
logrus.WithField("dir", dir.Name()).WithError(err).Error("Error removing stale layer dir") if strings.HasSuffix(entry.Name(), "-removing") {
logger.WithField("dir", entry.Name()).Debug("Cleaning up stale layer dir")
if err := system.EnsureRemoveAll(filepath.Join(p, entry.Name())); err != nil {
logger.WithField("dir", entry.Name()).WithError(err).Error("Error removing stale layer dir")
} }
} }
} }