summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpod/boltdb_state.go4
-rw-r--r--libpod/boltdb_state_internal.go4
-rw-r--r--libpod/runtime.go2
-rw-r--r--libpod/state_test.go3
4 files changed, 6 insertions, 7 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go
index 8b9b77a54..cb661d4e9 100644
--- a/libpod/boltdb_state.go
+++ b/libpod/boltdb_state.go
@@ -18,7 +18,6 @@ type BoltState struct {
dbLock sync.Mutex
namespace string
namespaceBytes []byte
- lockDir string
runtime *Runtime
}
@@ -51,10 +50,9 @@ type BoltState struct {
// containers/storage do not occur.
// NewBoltState creates a new bolt-backed state database
-func NewBoltState(path, lockDir string, runtime *Runtime) (State, error) {
+func NewBoltState(path string, runtime *Runtime) (State, error) {
state := new(BoltState)
state.dbPath = path
- state.lockDir = lockDir
state.runtime = runtime
state.namespace = ""
state.namespaceBytes = nil
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index 05536e069..3f00657ea 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -266,7 +266,7 @@ func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, ctrsBkt *bolt.
}
// Get the lock
- lockPath := filepath.Join(s.lockDir, string(id))
+ lockPath := filepath.Join(s.runtime.lockDir, string(id))
lock, err := storage.GetLockfile(lockPath)
if err != nil {
return errors.Wrapf(err, "error retrieving lockfile for container %s", string(id))
@@ -302,7 +302,7 @@ func (s *BoltState) getPodFromDB(id []byte, pod *Pod, podBkt *bolt.Bucket) error
}
// Get the lock
- lockPath := filepath.Join(s.lockDir, string(id))
+ lockPath := filepath.Join(s.runtime.lockDir, string(id))
lock, err := storage.GetLockfile(lockPath)
if err != nil {
return errors.Wrapf(err, "error retrieving lockfile for pod %s", string(id))
diff --git a/libpod/runtime.go b/libpod/runtime.go
index e69b63a24..083ab1ec3 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -494,7 +494,7 @@ func makeRuntime(runtime *Runtime) (err error) {
case BoltDBStateStore:
dbPath := filepath.Join(runtime.config.StaticDir, "bolt_state.db")
- state, err := NewBoltState(dbPath, runtime.lockDir, runtime)
+ state, err := NewBoltState(dbPath, runtime)
if err != nil {
return err
}
diff --git a/libpod/state_test.go b/libpod/state_test.go
index 0f5da62e4..d93a371f3 100644
--- a/libpod/state_test.go
+++ b/libpod/state_test.go
@@ -52,8 +52,9 @@ func getEmptyBoltState() (s State, p string, p2 string, err error) {
runtime := new(Runtime)
runtime.config = new(RuntimeConfig)
runtime.config.StorageConfig = storage.StoreOptions{}
+ runtime.lockDir = lockDir
- state, err := NewBoltState(dbPath, lockDir, runtime)
+ state, err := NewBoltState(dbPath, runtime)
if err != nil {
return nil, "", "", err
}