summaryrefslogtreecommitdiff
path: root/libpod/runtime.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-06-27 12:56:29 +0200
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-07-02 16:41:10 +0200
commit827ac0859f9649a971c6d4092fcd26158afa5478 (patch)
treea580e3e12a57347dcf29676025cff2167414a0e0 /libpod/runtime.go
parent82164a2e9ed5c6112e3ef70895c153025807b282 (diff)
downloadpodman-827ac0859f9649a971c6d4092fcd26158afa5478.tar.gz
podman-827ac0859f9649a971c6d4092fcd26158afa5478.tar.bz2
podman-827ac0859f9649a971c6d4092fcd26158afa5478.zip
lock: new lock type "file"
it is a wrapper around containers/storage file locking. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod/runtime.go')
-rw-r--r--libpod/runtime.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index e8442f4a1..ca10f9243 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -318,6 +318,7 @@ func defaultRuntimeConfig() (RuntimeConfig, error) {
NumLocks: 2048,
EventsLogger: events.DefaultEventerType.String(),
DetachKeys: DefaultDetachKeys,
+ LockType: "shm",
}, nil
}
@@ -664,6 +665,20 @@ func getLockManager(runtime *Runtime) (lock.Manager, error) {
var manager lock.Manager
switch runtime.config.LockType {
+ case "file":
+ lockPath := filepath.Join(runtime.config.TmpDir, "locks")
+ manager, err = lock.OpenFileLockManager(lockPath)
+ if err != nil {
+ if os.IsNotExist(errors.Cause(err)) {
+ manager, err = lock.NewFileLockManager(lockPath)
+ if err != nil {
+ return nil, errors.Wrapf(err, "failed to get new file lock manager")
+ }
+ } else {
+ return nil, err
+ }
+ }
+
case "", "shm":
lockPath := DefaultSHMLockPath
if rootless.IsRootless() {