From 734e7a8e55e41b064025273776dc5a76e45bf2e1 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 11 Oct 2018 12:44:43 +0200 Subject: [PATCH 1/3] Deprecate "devicemapper" storage driver, and add warning The `devicemapper` storage driver is deprecated in favor of `overlay2`, and will be removed in a future release. Users of the `devicemapper` storage driver are recommended to migrate to a different storage driver, such as `overlay2`, which is now the default storage driver. The `devicemapper` storage driver facilitates running Docker on older (3.x) kernels that have no support for other storage drivers (such as overlay2, or AUFS). Now that support for `overlay2` is added to all supported distros (as they are either on kernel 4.x, or have support for multiple lowerdirs backported), there is no reason to continue maintenance of the `devicemapper` storage driver. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 06fcabbaa0d4f25db0580d3604bbed708223fb06) Signed-off-by: Sebastiaan van Stijn --- daemon/graphdriver/driver.go | 21 +++++++++++++++++++++ daemon/info.go | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/daemon/graphdriver/driver.go b/daemon/graphdriver/driver.go index a9e1957393529..baf349ac731b4 100644 --- a/daemon/graphdriver/driver.go +++ b/daemon/graphdriver/driver.go @@ -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) + } +} diff --git a/daemon/info.go b/daemon/info.go index bf84342b54b5a..a0fd01eaaf084 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -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) From c20e8dffbbb4dd328e4c00d18e04eecb80cf4d4e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 11 Oct 2018 12:47:34 +0200 Subject: [PATCH 2/3] Deprecate legacy overlay storage driver, and add warning The `overlay` storage driver is deprecated in favor of the `overlay2` storage driver, which has all the benefits of `overlay`, without its limitations (excessive inode consumption). The legacy `overlay` storage driver will be removed in a future release. Users of the `overlay` storage driver should migrate to the `overlay2` storage driver. The legacy `overlay` storage driver allowed using overlayFS-backed filesystems on pre 4.x kernels. Now that all supported distributions are able to run `overlay2` (as they are either on kernel 4.x, or have support for multiple lowerdirs backported), there is no reason to keep maintaining the `overlay` storage driver. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit 31be4e0ba11532e5d6df8401f5d459e292c58f36) Signed-off-by: Sebastiaan van Stijn --- daemon/graphdriver/driver.go | 2 +- daemon/info.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/daemon/graphdriver/driver.go b/daemon/graphdriver/driver.go index baf349ac731b4..2db61aac49576 100644 --- a/daemon/graphdriver/driver.go +++ b/daemon/graphdriver/driver.go @@ -314,7 +314,7 @@ func isEmptyDir(name string) bool { func isDeprecated(name string) bool { switch name { // NOTE: when deprecating a driver, update daemon.fillDriverInfo() accordingly - case "devicemapper": + case "devicemapper", "overlay": return true } return false diff --git a/daemon/info.go b/daemon/info.go index a0fd01eaaf084..603474ab970b2 100644 --- a/daemon/info.go +++ b/daemon/info.go @@ -132,7 +132,7 @@ func (daemon *Daemon) fillDriverInfo(v *types.Info) { drivers += fmt.Sprintf(" (%s) ", os) } switch gd { - case "devicemapper": + case "devicemapper", "overlay": v.Warnings = append(v.Warnings, fmt.Sprintf("WARNING: the %s storage-driver is deprecated, and will be removed in a future release.", gd)) } } From 2aa353c8c1435118e797db2587bf38f00b93f805 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 11 Oct 2018 13:19:36 +0200 Subject: [PATCH 3/3] Skip deprecated storage-drivers in auto-selection Discourage users from using deprecated storage-drivers by skipping them when automatically selecting a storage- driver. This change does not affect existing installations, because existing state will take precedence. Users can still use deprecated drivers by manually configuring the daemon to use a specific driver. Signed-off-by: Sebastiaan van Stijn (cherry picked from commit b72db8b82c90753702b354535400439993c9f915) --- daemon/graphdriver/driver.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/graphdriver/driver.go b/daemon/graphdriver/driver.go index 2db61aac49576..109e00b3d83d3 100644 --- a/daemon/graphdriver/driver.go +++ b/daemon/graphdriver/driver.go @@ -253,6 +253,11 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err // Check all registered drivers if no priority driver is found for name, initFunc := range drivers { + if isDeprecated(name) { + // Deprecated storage-drivers are skipped in automatic selection, but + // can be selected through configuration. + continue + } driver, err := initFunc(filepath.Join(config.Root, name), config.DriverOptions, config.UIDMaps, config.GIDMaps) if err != nil { if IsDriverNotSupported(err) {