mirror of
https://github.com/containers/podman.git
synced 2025-05-21 09:05:56 +08:00
Add a restart event, and make one during restart policy
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -28,6 +28,7 @@ The *container* event type will report the follow statuses:
|
|||||||
* pause
|
* pause
|
||||||
* prune
|
* prune
|
||||||
* remove
|
* remove
|
||||||
|
* restart
|
||||||
* restore
|
* restore
|
||||||
* start
|
* start
|
||||||
* stop
|
* stop
|
||||||
|
@ -229,6 +229,8 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (err error) {
|
|||||||
return errors.Wrapf(ErrInternal, "invalid container state encountered in restart attempt!")
|
return errors.Wrapf(ErrInternal, "invalid container state encountered in restart attempt!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.newContainerEvent(events.Restart)
|
||||||
|
|
||||||
// Increment restart count
|
// Increment restart count
|
||||||
c.state.RestartCount = c.state.RestartCount + 1
|
c.state.RestartCount = c.state.RestartCount + 1
|
||||||
logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount)
|
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")
|
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 c.state.State == ContainerStateRunning {
|
||||||
if err := c.stop(timeout); err != nil {
|
if err := c.stop(timeout); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -134,6 +134,8 @@ const (
|
|||||||
// Renumber indicates that lock numbers were reallocated at user
|
// Renumber indicates that lock numbers were reallocated at user
|
||||||
// request.
|
// request.
|
||||||
Renumber Status = "renumber"
|
Renumber Status = "renumber"
|
||||||
|
// Restart indicates the target was restarted via an API call.
|
||||||
|
Restart Status = "restart"
|
||||||
// Restore ...
|
// Restore ...
|
||||||
Restore Status = "restore"
|
Restore Status = "restore"
|
||||||
// Save ...
|
// Save ...
|
||||||
|
Reference in New Issue
Block a user