From 0abd7ba22998e2ad00091c4ddc0f9ea28625adfe Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 12 May 2022 22:59:16 +0200 Subject: [PATCH] volume/local: remove hack for downgrading docker 1.7 to 1.6 This was added in bd9814f0db9c8a087e42b66eabb8413bf1b2ab66 to support downgrading docker 1.7 to 1.6. The related migration code was removed in 0023abbad34282762d5bd17302776d2a8521fffc (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 --- volume/local/local.go | 10 +++++----- volume/local/local_unix.go | 9 --------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/volume/local/local.go b/volume/local/local.go index 29e3cc9a54..eb78814ab0 100644 --- a/volume/local/local.go +++ b/volume/local/local.go @@ -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. diff --git a/volume/local/local_unix.go b/volume/local/local_unix.go index 4fdd182544..3ef2db40c3 100644 --- a/volume/local/local_unix.go +++ b/volume/local/local_unix.go @@ -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 }