diff --git a/daemon/graphdriver/driver.go b/daemon/graphdriver/driver.go index e9d2f6afc1..3372b1358e 100644 --- a/daemon/graphdriver/driver.go +++ b/daemon/graphdriver/driver.go @@ -193,7 +193,9 @@ type Options struct { func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, error) { if name != "" { logrus.Infof("[graphdriver] trying configured driver: %s", name) - logDeprecatedWarning(name) + if isDeprecated(name) { + logrus.Warnf("[graphdriver] WARNING: the %s storage-driver is deprecated and will be removed in a future release; visit https://docs.docker.com/go/storage-driver/ for more information", name) + } return GetDriver(name, pg, config) } @@ -214,6 +216,11 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err logrus.Errorf("[graphdriver] prior storage driver %s failed: %s", name, err) return nil, err } + if isDeprecated(name) { + err = errors.Errorf("prior storage driver %s is deprecated and will be removed in a future release; update the the daemon configuration and explicitly choose this storage driver to continue using it; visit https://docs.docker.com/go/storage-driver/ for more information", name) + logrus.Errorf("[graphdriver] %v", err) + return nil, err + } // abort starting when there are other prior configured drivers // to ensure the user explicitly selects the driver to load @@ -229,14 +236,18 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err } logrus.Infof("[graphdriver] using prior storage driver: %s", name) - logDeprecatedWarning(name) return driver, nil } } // If no prior state was found, continue with automatic selection, and pick - // the first supported storage driver (in order of priorityList). + // the first supported, non-deprecated, storage driver (in order of priorityList). for _, name := range priorityList { + if isDeprecated(name) { + // Deprecated storage-drivers are skipped in automatic selection, but + // can be selected through configuration. + continue + } driver, err := getBuiltinDriver(name, config.Root, config.DriverOptions, config.IDMap) if err != nil { if IsDriverNotSupported(err) { @@ -244,7 +255,6 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err } return nil, err } - logDeprecatedWarning(name) return driver, nil } @@ -322,10 +332,3 @@ func isDeprecated(name string) bool { } return false } - -// logDeprecatedWarning logs a warning if the given storage-driver is marked "deprecated" -func logDeprecatedWarning(name string) { - if isDeprecated(name) { - logrus.Warnf("[graphdriver] WARNING: the %s storage-driver is deprecated, and will be removed in a future release", name) - } -} diff --git a/daemon/info.go b/daemon/info.go index 367e670055..93a883cadb 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -124,9 +124,13 @@ func (daemon *Daemon) SystemVersion() types.Version { } func (daemon *Daemon) fillDriverInfo(v *types.Info) { + const warnMsg = ` +WARNING: The %s storage-driver is deprecated, and will be removed in a future release. + Refer to the documentation for more information: https://docs.docker.com/go/storage-driver/` + switch daemon.graphDriver { case "aufs", "devicemapper", "overlay": - v.Warnings = append(v.Warnings, fmt.Sprintf("WARNING: the %s storage-driver is deprecated, and will be removed in a future release.", daemon.graphDriver)) + v.Warnings = append(v.Warnings, fmt.Sprintf(warnMsg, daemon.graphDriver)) } v.Driver = daemon.graphDriver