diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-08-27 13:45:11 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-08-28 11:35:00 -0400 |
commit | e563f4111600a6c5506e4953bf796783a097544f (patch) | |
tree | 54cae975be3d0de2805d15d3305d74ef798ce799 /libpod/runtime_renumber.go | |
parent | f221c6101934fccbd6705f3b387aadc9ae710f66 (diff) | |
download | podman-e563f4111600a6c5506e4953bf796783a097544f.tar.gz podman-e563f4111600a6c5506e4953bf796783a097544f.tar.bz2 podman-e563f4111600a6c5506e4953bf796783a097544f.zip |
Re-add locks to volumes.
This will require a 'podman system renumber' after being applied
to get lock numbers for existing volumes.
Add the DB backend code for rewriting volume configs and use it
for updating lock numbers as part of 'system renumber'.
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/runtime_renumber.go')
-rw-r--r-- | libpod/runtime_renumber.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/libpod/runtime_renumber.go b/libpod/runtime_renumber.go index 735ffba34..9de2556b2 100644 --- a/libpod/runtime_renumber.go +++ b/libpod/runtime_renumber.go @@ -53,6 +53,23 @@ func (r *Runtime) renumberLocks() error { return err } } + allVols, err := r.state.AllVolumes() + if err != nil { + return err + } + for _, vol := range allVols { + lock, err := r.lockManager.AllocateLock() + if err != nil { + return errors.Wrapf(err, "error allocating lock for volume %s", vol.Name()) + } + + vol.config.LockID = lock.ID() + + // Write the new lock ID + if err := r.state.RewriteVolumeConfig(vol, vol.config); err != nil { + return err + } + } r.newSystemEvent(events.Renumber) |