summaryrefslogtreecommitdiff
path: root/libpod/container_internal.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-12-02 16:31:11 +0100
committerGitHub <noreply@github.com>2019-12-02 16:31:11 +0100
commite4275b3453598c3cdcf1ee00ff73c55780aef444 (patch)
tree15915f36125dfd9db9d56440f2a89f0610aa52fc /libpod/container_internal.go
parent39c705e9405faa4d02b71165d05eec1e7bb44d93 (diff)
parent6c405b5fbcc83ba49c187087eb4e1ccc1a7ff147 (diff)
downloadpodman-e4275b3453598c3cdcf1ee00ff73c55780aef444.tar.gz
podman-e4275b3453598c3cdcf1ee00ff73c55780aef444.tar.bz2
podman-e4275b3453598c3cdcf1ee00ff73c55780aef444.zip
Merge pull request #4493 from mheon/add_removing_state
Add ContainerStateRemoving
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r--libpod/container_internal.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 4ff1913b5..1e8a8a580 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -719,7 +719,8 @@ func (c *Container) isStopped() (bool, error) {
if err != nil {
return true, err
}
- return c.state.State != define.ContainerStateRunning && c.state.State != define.ContainerStatePaused, nil
+
+ return !c.ensureState(define.ContainerStateRunning, define.ContainerStatePaused), nil
}
// save container state to the database
@@ -1057,6 +1058,8 @@ func (c *Container) initAndStart(ctx context.Context) (err error) {
// If we are ContainerStateUnknown, throw an error
if c.state.State == define.ContainerStateUnknown {
return errors.Wrapf(define.ErrCtrStateInvalid, "container %s is in an unknown state", c.ID())
+ } else if c.state.State == define.ContainerStateRemoving {
+ return errors.Wrapf(define.ErrCtrStateInvalid, "cannot start container %s as it is being removed", c.ID())
}
// If we are running, do nothing