Ensure we generate a 'stopped' event on force-remove

When forcibly removing a container, we are initiating an explicit
stop of the container, which is not reflected in 'podman events'.
Swap to using our standard 'stop()' function instead of a custom
one for force-remove, and move the event into the internal stop
function (so internal calls also register it).

This does add one more database save() to `podman remove`. This
should not be a terribly serious performance hit, and does have
the desirable side effect of making things generally safer.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2019-07-31 17:22:08 -04:00
parent ef2d96a7a8
commit 9dcd76e369
3 changed files with 9 additions and 8 deletions

View File

@ -187,7 +187,7 @@ func (c *Container) StopWithTimeout(timeout uint) error {
c.state.State == define.ContainerStateExited {
return define.ErrCtrStopped
}
defer c.newContainerEvent(events.Stop)
return c.stop(timeout)
}