summaryrefslogtreecommitdiff
path: root/libpod/sql_state_internal.go
diff options
context:
space:
mode:
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)