summaryrefslogtreecommitdiff
path: root/libpod/runtime_renumber.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-02-14 17:55:54 -0500
committerMatthew Heon <matthew.heon@pm.me>2019-02-21 10:51:42 -0500
commit9353a3e8ec3855f29c552dd1e0134dbaa3031efa (patch)
tree071af2a20551d7f7310dbafdfa0ff1894dfbd2d2 /libpod/runtime_renumber.go
parenta3dbb7a837f0c6fe9e12aec6da3778759632f7d1 (diff)
downloadpodman-9353a3e8ec3855f29c552dd1e0134dbaa3031efa.tar.gz
podman-9353a3e8ec3855f29c552dd1e0134dbaa3031efa.tar.bz2
podman-9353a3e8ec3855f29c552dd1e0134dbaa3031efa.zip
Expand renumber to also renumber pod locks
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/runtime_renumber.go')
-rw-r--r--libpod/runtime_renumber.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/libpod/runtime_renumber.go b/libpod/runtime_renumber.go
index bc291156e..b27b5f1a8 100644
--- a/libpod/runtime_renumber.go
+++ b/libpod/runtime_renumber.go
@@ -52,6 +52,23 @@ func (r *Runtime) RenumberLocks() error {
return err
}
}
+ allPods, err := r.state.AllPods()
+ if err != nil {
+ return err
+ }
+ for _, pod := range allPods {
+ lock, err := r.lockManager.AllocateLock()
+ if err != nil {
+ return errors.Wrapf(err, "error allocating lock for pod %s", pod.ID())
+ }
+
+ pod.config.LockID = lock.ID()
+
+ // Write the new lock ID
+ if err := r.state.RewritePodConfig(pod, pod.config); err != nil {
+ return err
+ }
+ }
r.lock.Unlock()
locked = false