From 9dcd76e369fb163774f8f58a7da24a7899e95b60 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Wed, 31 Jul 2019 17:22:08 -0400 Subject: 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 --- libpod/runtime_ctr.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'libpod/runtime_ctr.go') diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go index e57ab4634..47d49f6aa 100644 --- a/libpod/runtime_ctr.go +++ b/libpod/runtime_ctr.go @@ -394,14 +394,9 @@ func (r *Runtime) removeContainer(ctx context.Context, c *Container, force bool, // Check that the container's in a good state to be removed if c.state.State == config2.ContainerStateRunning { - if err := c.ociRuntime.stopContainer(c, c.StopTimeout()); err != nil { + if err := c.stop(c.StopTimeout()); err != nil { return errors.Wrapf(err, "cannot remove container %s as it could not be stopped", c.ID()) } - - // Need to update container state to make sure we know it's stopped - if err := c.waitForExitFileAndSync(); err != nil { - return err - } } // Check that all of our exec sessions have finished -- cgit v1.2.3-54-g00ecf