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

daemon/images: ImageService.Cleanup(): return error instead of logging

This makes the function a bit more idiomatic, and leaves it to the caller to
decide wether or not the error can be ignored.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-01-21 20:25:01 +01:00
parent 32e5fe5099
commit 79cad59d97
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 6 additions and 4 deletions

View file

@ -1206,7 +1206,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

View file

@ -20,7 +20,6 @@ import (
"github.com/docker/libtrust"
digest "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