summaryrefslogtreecommitdiff
path: root/libpod/sql_state_internal.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-12-11 10:48:29 -0600
committerGitHub <noreply@github.com>2017-12-11 10:48:29 -0600
commit12682aa475db17d99eb0cfc5efad20e1b9f3685f (patch)
treee0f280f5f892025bea20a8cfd2c5cc4e7e1f0dc0 /libpod/sql_state_internal.go
parent62e19beeecc8f4af97388c0e715c92b582fbe685 (diff)
parent190b05209f95cf611eb5cafc4bf4cce875c74e9e (diff)
downloadpodman-12682aa475db17d99eb0cfc5efad20e1b9f3685f.tar.gz
podman-12682aa475db17d99eb0cfc5efad20e1b9f3685f.tar.bz2
podman-12682aa475db17d99eb0cfc5efad20e1b9f3685f.zip
Merge pull request #72 from mheon/file_locking
Move containers to file locks from c/storage
Diffstat (limited to 'libpod/sql_state_internal.go')
-rw-r--r--libpod/sql_state_internal.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/sql_state_internal.go b/libpod/sql_state_internal.go
index 3aee8f638..515b5b6ad 100644
--- a/libpod/sql_state_internal.go
+++ b/libpod/sql_state_internal.go
@@ -7,6 +7,7 @@ import (
"path/filepath"
"time"
+ "github.com/containers/storage"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -266,7 +267,7 @@ type scannable interface {
}
// Read a single container from a single row result in the database
-func ctrFromScannable(row scannable, runtime *Runtime, specsDir string) (*Container, error) {
+func ctrFromScannable(row scannable, runtime *Runtime, specsDir string, lockDir string) (*Container, error) {
var (
id string
name string
@@ -384,6 +385,14 @@ func ctrFromScannable(row scannable, runtime *Runtime, specsDir string) (*Contai
ctr.valid = true
ctr.runtime = runtime
+ // Open and set the lockfile
+ lockPath := filepath.Join(lockDir, id)
+ lock, err := storage.GetLockfile(lockPath)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error retrieving lockfile for container %s", id)
+ }
+ ctr.lock = lock
+
// Retrieve the spec from disk
ociSpec := new(spec.Spec)
specPath := getSpecPath(specsDir, id)