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

volume/local: remove hack for downgrading docker 1.7 to 1.6

This was added in bd9814f0db to support downgrading
docker 1.7 to 1.6.

The related migration code was removed in 0023abbad3
(Docker 18.05), which was also the last consumer of VolumeDataPathName outside
of the package, so that const can be un-exported.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-05-12 22:59:16 +02:00
parent 888c618c15
commit 0abd7ba229
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
2 changed files with 5 additions and 14 deletions

View file

@ -21,11 +21,11 @@ import (
"github.com/sirupsen/logrus"
)
// VolumeDataPathName is the name of the directory where the volume data is stored.
// It uses a very distinctive name to avoid collisions migrating data between
// Docker versions.
const (
VolumeDataPathName = "_data"
// volumeDataPathName is the name of the directory where the volume data is stored.
// It uses a very distinctive name to avoid collisions migrating data between
// Docker versions.
volumeDataPathName = "_data"
volumesPathName = "volumes"
)
@ -127,7 +127,7 @@ func (r *Root) List() ([]volume.Volume, error) {
// DataPath returns the constructed path of this volume.
func (r *Root) DataPath(volumeName string) string {
return filepath.Join(r.path, volumeName, VolumeDataPathName)
return filepath.Join(r.path, volumeName, volumeDataPathName)
}
// Name returns the name of Root, defined in the volume package in the DefaultDriverName constant.

View file

@ -24,8 +24,6 @@ import (
)
var (
oldVfsDir = filepath.Join("vfs", "dir")
validOpts = map[string]struct{}{
"type": {}, // specify the filesystem type for mount, e.g. nfs
"o": {}, // generic mount options
@ -53,16 +51,9 @@ func (o *optsConfig) String() string {
// scopedPath verifies that the path where the volume is located
// is under Docker's root and the valid local paths.
func (r *Root) scopedPath(realPath string) bool {
// Volumes path for Docker version >= 1.7
if strings.HasPrefix(realPath, filepath.Join(r.scope, volumesPathName)) && realPath != filepath.Join(r.scope, volumesPathName) {
return true
}
// Volumes path for Docker version < 1.7
if strings.HasPrefix(realPath, filepath.Join(r.scope, oldVfsDir)) {
return true
}
return false
}