diff options
-rw-r--r-- | docs/podman-events.1.md | 1 | ||||
-rw-r--r-- | libpod/container_internal.go | 4 | ||||
-rw-r--r-- | libpod/events/config.go | 2 |
3 files changed, 7 insertions, 0 deletions
diff --git a/docs/podman-events.1.md b/docs/podman-events.1.md index da142c0fb..3ccecac28 100644 --- a/docs/podman-events.1.md +++ b/docs/podman-events.1.md @@ -28,6 +28,7 @@ The *container* event type will report the follow statuses: * pause * prune * remove + * restart * restore * start * stop diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 22ed34987..00f916d0f 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -229,6 +229,8 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (err error) { return errors.Wrapf(ErrInternal, "invalid container state encountered in restart attempt!") } + c.newContainerEvent(events.Restart) + // Increment restart count c.state.RestartCount = c.state.RestartCount + 1 logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount) @@ -1060,6 +1062,8 @@ func (c *Container) restartWithTimeout(ctx context.Context, timeout uint) (err e return errors.Wrapf(ErrCtrStateInvalid, "unable to restart a container in a paused or unknown state") } + c.newContainerEvent(events.Restart) + if c.state.State == ContainerStateRunning { if err := c.stop(timeout); err != nil { return err diff --git a/libpod/events/config.go b/libpod/events/config.go index 36387e835..810988205 100644 --- a/libpod/events/config.go +++ b/libpod/events/config.go @@ -134,6 +134,8 @@ const ( // Renumber indicates that lock numbers were reallocated at user // request. Renumber Status = "renumber" + // Restart indicates the target was restarted via an API call. + Restart Status = "restart" // Restore ... Restore Status = "restore" // Save ... |