summaryrefslogtreecommitdiff
path: root/libpod/boltdb_state.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-06-21 09:45:03 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-22 19:26:46 +0000
commit334345671759d521ee6fbe7f6e1e7392ee312ab4 (patch)
tree0478ad55c1430af8834ac94a8306272499fb98a2 /libpod/boltdb_state.go
parent7a7d0f1446590f5895869d26f7dc9893fa5be3a2 (diff)
downloadpodman-334345671759d521ee6fbe7f6e1e7392ee312ab4.tar.gz
podman-334345671759d521ee6fbe7f6e1e7392ee312ab4.tar.bz2
podman-334345671759d521ee6fbe7f6e1e7392ee312ab4.zip
Add Refresh() to ctrs to refresh state after db change
The Refresh() function is used to reset a container's state after a database format change to state is made that requires migration Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #981 Approved by: baude
Diffstat (limited to 'libpod/boltdb_state.go')
-rw-r--r--libpod/boltdb_state.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go
index 7880265b6..3ee24122a 100644
--- a/libpod/boltdb_state.go
+++ b/libpod/boltdb_state.go
@@ -174,15 +174,9 @@ func (s *BoltState) Refresh() error {
return errors.Wrapf(err, "error unmarshalling state for container %s", string(id))
}
- state.PID = 0
- state.Mountpoint = ""
- state.Mounted = false
- state.State = ContainerStateConfigured
- state.ExecSessions = make(map[string]*ExecSession)
- state.IPs = nil
- state.Interfaces = nil
- state.Routes = nil
- state.BindMounts = make(map[string]string)
+ if err := resetState(state); err != nil {
+ return errors.Wrapf(err, "error resetting state for container %s", string(id))
+ }
newStateBytes, err := json.Marshal(state)
if err != nil {