aboutsummaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2017-12-06 11:15:17 -0500
committerMatthew Heon <matthew.heon@gmail.com>2017-12-06 11:15:17 -0500
commitb66287689a0c8c9f2f8c01cdca065fb1f6e8d872 (patch)
treea15f1b5c3e3a5bc9f22a22bf967111565fc6087d /libpod/container.go
parentceb7fb1c60e559337523259f1e0063135e686c95 (diff)
downloadpodman-b66287689a0c8c9f2f8c01cdca065fb1f6e8d872.tar.gz
podman-b66287689a0c8c9f2f8c01cdca065fb1f6e8d872.tar.bz2
podman-b66287689a0c8c9f2f8c01cdca065fb1f6e8d872.zip
Do not recreate containers in runc after restart
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go26
1 files changed, 4 insertions, 22 deletions
diff --git a/libpod/container.go b/libpod/container.go
index d12167d15..adc52d85f 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -428,23 +428,11 @@ func (c *Container) refresh() error {
c.state.Mounted = false
c.state.Mountpoint = ""
- // The container is no longe running
+ // The container is no longer running
c.state.PID = 0
- // Check the container's state. If it's not created in runc yet, we're
- // done
- if c.state.State == ContainerStateConfigured {
- if err := c.runtime.state.SaveContainer(c); err != nil {
- return errors.Wrapf(err, "error refreshing state for container %s", c.ID())
- }
-
- return nil
- }
-
- // The container must be recreated in runc
- if err := c.init(); err != nil {
- return err
- }
+ // The container no longer exists in runc
+ c.state.State = ContainerStateConfigured
if err := c.runtime.state.SaveContainer(c); err != nil {
return errors.Wrapf(err, "error refreshing state for container %s", c.ID())
@@ -454,7 +442,7 @@ func (c *Container) refresh() error {
}
// Init creates a container in the OCI runtime
-func (c *Container) Init() error {
+func (c *Container) Init() (err error) {
c.lock.Lock()
defer c.lock.Unlock()
@@ -466,12 +454,6 @@ func (c *Container) Init() error {
return errors.Wrapf(ErrCtrExists, "container %s has already been created in runtime", c.ID())
}
- return c.init()
-}
-
-// Creates container in OCI runtime
-// Internal only - does not lock or check state
-func (c *Container) init() (err error) {
if err := c.mountStorage(); err != nil {
return err
}