diff options
author | Matthew Heon <mheon@redhat.com> | 2021-10-06 09:25:24 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-10-19 14:13:07 -0400 |
commit | 7bbf774e858fa3e535d9d22d72836459608eb095 (patch) | |
tree | d12ba9505d093f19ab8ca33696b0ff2c85cf8f4c /libpod | |
parent | 2cd206d0fce477d123ab8b7acf19fdf34ca0a7aa (diff) | |
download | podman-7bbf774e858fa3e535d9d22d72836459608eb095.tar.gz podman-7bbf774e858fa3e535d9d22d72836459608eb095.tar.bz2 podman-7bbf774e858fa3e535d9d22d72836459608eb095.zip |
Allow `podman stop` to be run on Stopping containers
This allows you to stop a container after a `podman stop` process
started, but did not finish, stopping the container (probably an
ignored stop signal, with no time to SIGKILL?). This is a very
narrow case, but once you're in it the only way to recover is a
`podman rm -f` of the container or extensive manual remediation
(you'd have to kill the container yourself, manually, and then
force a `podman ps --all --sync` to update its status from the
OCI runtime).
[NO NEW TESTS NEEDED] I have no idea how to verify this one -
we need to test that it actually started *during* the other stop
command, and that's nontrivial.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_api.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go index 637f5b686..cc845fe2e 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -184,7 +184,7 @@ func (c *Container) StopWithTimeout(timeout uint) error { return define.ErrCtrStopped } - if !c.ensureState(define.ContainerStateCreated, define.ContainerStateRunning) { + if !c.ensureState(define.ContainerStateCreated, define.ContainerStateRunning, define.ContainerStateStopping) { return errors.Wrapf(define.ErrCtrStateInvalid, "can only stop created or running containers. %s is in state %s", c.ID(), c.state.State.String()) } |