Browse code

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 <github@gone.nl>

Sebastiaan van Stijn authored on 2018/10/11 19:44:43
Showing 2 changed files
... ...
@@ -195,6 +195,7 @@ type Options struct {
195 195
 func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, error) {
196 196
 	if name != "" {
197 197
 		logrus.Debugf("[graphdriver] trying provided driver: %s", name) // so the logs show specified driver
198
+		logDeprecatedWarning(name)
198 199
 		return GetDriver(name, pg, config)
199 200
 	}
200 201
 
... ...
@@ -232,6 +233,7 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err
232 232
 			}
233 233
 
234 234
 			logrus.Infof("[graphdriver] using prior storage driver: %s", name)
235
+			logDeprecatedWarning(name)
235 236
 			return driver, nil
236 237
 		}
237 238
 	}
... ...
@@ -245,6 +247,7 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err
245 245
 			}
246 246
 			return nil, err
247 247
 		}
248
+		logDeprecatedWarning(name)
248 249
 		return driver, nil
249 250
 	}
250 251
 
... ...
@@ -257,6 +260,7 @@ func New(name string, pg plugingetter.PluginGetter, config Options) (Driver, err
257 257
 			}
258 258
 			return nil, err
259 259
 		}
260
+		logDeprecatedWarning(name)
260 261
 		return driver, nil
261 262
 	}
262 263
 	return nil, fmt.Errorf("No supported storage backend found")
... ...
@@ -305,3 +309,20 @@ func isEmptyDir(name string) bool {
305 305
 	}
306 306
 	return false
307 307
 }
308
+
309
+// isDeprecated checks if a storage-driver is marked "deprecated"
310
+func isDeprecated(name string) bool {
311
+	switch name {
312
+	// NOTE: when deprecating a driver, update daemon.fillDriverInfo() accordingly
313
+	case "devicemapper":
314
+		return true
315
+	}
316
+	return false
317
+}
318
+
319
+// logDeprecatedWarning logs a warning if the given storage-driver is marked "deprecated"
320
+func logDeprecatedWarning(name string) {
321
+	if isDeprecated(name) {
322
+		logrus.Warnf("[graphdriver] WARNING: the %s storage-driver is deprecated, and will be removed in a future release", name)
323
+	}
324
+}
... ...
@@ -131,6 +131,10 @@ func (daemon *Daemon) fillDriverInfo(v *types.Info) {
131 131
 		if len(daemon.graphDrivers) > 1 {
132 132
 			drivers += fmt.Sprintf(" (%s) ", os)
133 133
 		}
134
+		switch gd {
135
+		case "devicemapper":
136
+			v.Warnings = append(v.Warnings, fmt.Sprintf("WARNING: the %s storage-driver is deprecated, and will be removed in a future release.", gd))
137
+		}
134 138
 	}
135 139
 	drivers = strings.TrimSpace(drivers)
136 140