Browse Source

Merge pull request #43255 from thaJeztah/imageservice_nologs

daemon/images: ImageService.Cleanup(): return error instead of logging
Sebastiaan van Stijn 3 years ago
parent
commit
85f1bfc6f7
2 changed files with 6 additions and 4 deletions
  1. 3 1
      daemon/daemon.go
  2. 3 3
      daemon/images/service.go

+ 3 - 1
daemon/daemon.go

@@ -1205,7 +1205,9 @@ func (daemon *Daemon) Shutdown() error {
 	}
 
 	if daemon.imageService != nil {
-		daemon.imageService.Cleanup()
+		if err := daemon.imageService.Cleanup(); err != nil {
+			logrus.Error(err)
+		}
 	}
 
 	// If we are part of a cluster, clean up cluster's stuff

+ 3 - 3
daemon/images/service.go

@@ -20,7 +20,6 @@ import (
 	"github.com/docker/libtrust"
 	"github.com/opencontainers/go-digest"
 	"github.com/pkg/errors"
-	"github.com/sirupsen/logrus"
 	"golang.org/x/sync/singleflight"
 )
 
@@ -167,10 +166,11 @@ func (i *ImageService) GetLayerMountID(cid string) (string, error) {
 
 // Cleanup resources before the process is shutdown.
 // called from daemon.go Daemon.Shutdown()
-func (i *ImageService) Cleanup() {
+func (i *ImageService) Cleanup() error {
 	if err := i.layerStore.Cleanup(); err != nil {
-		logrus.Errorf("Error during layer Store.Cleanup(): %v", err)
+		return errors.Wrap(err, "error during layerStore.Cleanup()")
 	}
+	return nil
 }
 
 // GraphDriverName returns the name of the graph drvier