mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Allow existing setups to continue using d_type
Even though it's highly discouraged, there are existing installs that are running overlay/overlay2 on filesystems without d_type support. This patch allows the daemon to start in such cases, instead of refusing to start without an option to override. For fresh installs, backing filesystems without d_type support will still cause the overlay/overlay2 drivers to be marked as "unsupported", and skipped during the automatic selection. This feature is only to keep backward compatibility, but will be removed at some point. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
0abb8dec3f
commit
0a4e793a3d
3 changed files with 22 additions and 2 deletions
|
@ -277,6 +277,18 @@ func scanPriorDrivers(root string) map[string]bool {
|
||||||
return driversMap
|
return driversMap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IsInitialized checks if the driver's home-directory exists and is non-empty.
|
||||||
|
func IsInitialized(driverHome string) bool {
|
||||||
|
_, err := os.Stat(driverHome)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
logrus.Warnf("graphdriver.IsInitialized: stat failed: %v", err)
|
||||||
|
}
|
||||||
|
return !isEmptyDir(driverHome)
|
||||||
|
}
|
||||||
|
|
||||||
// isEmptyDir checks if a directory is empty. It is used to check if prior
|
// isEmptyDir checks if a directory is empty. It is used to check if prior
|
||||||
// storage-driver directories exist. If an error occurs, it also assumes the
|
// storage-driver directories exist. If an error occurs, it also assumes the
|
||||||
// directory is not empty (which preserves the behavior _before_ this check
|
// directory is not empty (which preserves the behavior _before_ this check
|
||||||
|
|
|
@ -148,8 +148,12 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !supportsDType {
|
if !supportsDType {
|
||||||
|
if !graphdriver.IsInitialized(home) {
|
||||||
return nil, overlayutils.ErrDTypeNotSupported("overlay", backingFs)
|
return nil, overlayutils.ErrDTypeNotSupported("overlay", backingFs)
|
||||||
}
|
}
|
||||||
|
// allow running without d_type only for existing setups (#27443)
|
||||||
|
logrus.Warn(overlayutils.ErrDTypeNotSupported("overlay", backingFs))
|
||||||
|
}
|
||||||
|
|
||||||
rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
|
rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -184,8 +184,12 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if !supportsDType {
|
if !supportsDType {
|
||||||
|
if !graphdriver.IsInitialized(home) {
|
||||||
return nil, overlayutils.ErrDTypeNotSupported("overlay2", backingFs)
|
return nil, overlayutils.ErrDTypeNotSupported("overlay2", backingFs)
|
||||||
}
|
}
|
||||||
|
// allow running without d_type only for existing setups (#27443)
|
||||||
|
logrus.Warn(overlayutils.ErrDTypeNotSupported("overlay2", backingFs))
|
||||||
|
}
|
||||||
|
|
||||||
rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
|
rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue