Skip to content

Commit

Permalink
Deprecate "devicemapper" storage driver, and add warning
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
thaJeztah committed Oct 11, 2018
1 parent 1f48759 commit 06fcabb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
21 changes: 21 additions & 0 deletions daemon/graphdriver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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
}
}
Expand All @@ -245,6 +247,7 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err
}
return nil, err
}
logDeprecatedWarning(name)
return driver, nil
}

Expand All @@ -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")
Expand Down Expand Up @@ -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)
}
}
4 changes: 4 additions & 0 deletions daemon/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 06fcabb

Please sign in to comment.