Validate VolumePath against DB configuration

If this doesn't match, we end up not being able to access named
volumes mounted into containers, which is bad. Use the same
validation that we use for other critical paths to ensure this
one also matches.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2019-02-21 09:42:22 -05:00
parent da70c9db6f
commit d41d8d090e
5 changed files with 19 additions and 2 deletions

View File

@ -38,6 +38,7 @@ const (
graphRootName = "graph-root"
graphDriverName = "graph-driver-name"
osName = "os"
volPathName = "volume-path"
)
var (
@ -67,6 +68,7 @@ var (
graphRootKey = []byte(graphRootName)
graphDriverKey = []byte(graphDriverName)
osKey = []byte(osName)
volPathKey = []byte(volPathName)
)
// Check if the configuration of the database is compatible with the
@ -105,10 +107,15 @@ func checkRuntimeConfig(db *bolt.DB, rt *Runtime) error {
return err
}
return validateDBAgainstConfig(configBkt, "storage graph driver",
if err := validateDBAgainstConfig(configBkt, "storage graph driver",
rt.config.StorageConfig.GraphDriverName,
graphDriverKey,
storage.DefaultStoreOptions.GraphDriverName)
storage.DefaultStoreOptions.GraphDriverName); err != nil {
return err
}
return validateDBAgainstConfig(configBkt, "volume path",
rt.config.VolumePath, volPathKey, "")
})
return err