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

Merge pull request #38017 from thaJeztah/add_devicemapper_deprecation_warning

Deprecate "devicemapper" storage driver, and add warning
This commit is contained in:
Sebastiaan van Stijn 2018-10-12 00:08:55 +02:00 committed by GitHub
commit 512531f249
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View file

@ -195,6 +195,7 @@ type Options struct {
func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, error) {
if name != "" {
logrus.Debugf("[graphdriver] trying provided driver: %s", name) // so the logs show specified driver
logDeprecatedWarning(name)
return GetDriver(name, pg, config)
}
@ -232,6 +233,7 @@ 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
}
}
@ -245,6 +247,7 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err
}
return nil, err
}
logDeprecatedWarning(name)
return driver, nil
}
@ -257,6 +260,7 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err
}
return nil, err
}
logDeprecatedWarning(name)
return driver, nil
}
return nil, fmt.Errorf("No supported storage backend found")
@ -305,3 +309,20 @@ func isEmptyDir(name string) bool {
}
return false
}
// isDeprecated checks if a storage-driver is marked "deprecated"
func isDeprecated(name string) bool {
switch name {
// NOTE: when deprecating a driver, update daemon.fillDriverInfo() accordingly
case "devicemapper":
return true
}
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)
}
}

View file

@ -131,6 +131,10 @@ func (daemon *Daemon) fillDriverInfo(v *types.Info) {
if len(daemon.graphDrivers) > 1 {
drivers += fmt.Sprintf(" (%s) ", os)
}
switch gd {
case "devicemapper":
v.Warnings = append(v.Warnings, fmt.Sprintf("WARNING: the %s storage-driver is deprecated, and will be removed in a future release.", gd))
}
}
drivers = strings.TrimSpace(drivers)