diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2017-11-24 13:39:29 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@gmail.com> | 2017-12-04 13:39:44 -0500 |
commit | abfd18b0db8cb0ea331d90d702eab19e2157b973 (patch) | |
tree | fb0c9c3e941d0b647af9fe701e535d5db816c41f /libpod/runtime.go | |
parent | 750fc239b5da8e3f2792ae33f46a671ddf4622e3 (diff) | |
download | podman-abfd18b0db8cb0ea331d90d702eab19e2157b973.tar.gz podman-abfd18b0db8cb0ea331d90d702eab19e2157b973.tar.bz2 podman-abfd18b0db8cb0ea331d90d702eab19e2157b973.zip |
Move containers to file locks from c/storage
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r-- | libpod/runtime.go | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index b86e06546..616641fc1 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -25,6 +25,7 @@ type Runtime struct { storageService *storageService imageContext *types.SystemContext ociRuntime *OCIRuntime + locksDir string valid bool lock sync.RWMutex } @@ -136,6 +137,17 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) { } } + // Make a directory to hold container lockfiles + lockPath := filepath.Join(runtime.config.StaticDir, "lock") + if err := os.MkdirAll(lockPath, 0755); err != nil { + // The directory is allowed to exist + if !os.IsExist(err) { + return nil, errors.Wrapf(err, "error creating runtime lockfiles directory %s", + lockPath) + } + } + runtime.locksDir = lockPath + // Make the per-boot files directory if it does not exist if err := os.MkdirAll(runtime.config.TmpDir, 0755); err != nil { // The directory is allowed to exist @@ -166,7 +178,7 @@ func NewRuntime(options ...RuntimeOption) (runtime *Runtime, err error) { } } - state, err := NewSQLState(dbPath, lockPath, specsDir, runtime) + state, err := NewSQLState(dbPath, lockPath, specsDir, runtime.locksDir, runtime) if err != nil { return nil, err } |