mirror of
https://github.com/containers/podman.git
synced 2025-07-15 03:02:52 +08:00
Change pause so only running containers are valid
Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
@ -524,8 +524,8 @@ func (c *Container) Pause() error {
|
|||||||
if c.state.State == ContainerStatePaused {
|
if c.state.State == ContainerStatePaused {
|
||||||
return errors.Wrapf(ErrCtrStateInvalid, "%q is already paused", c.ID())
|
return errors.Wrapf(ErrCtrStateInvalid, "%q is already paused", c.ID())
|
||||||
}
|
}
|
||||||
if c.state.State != ContainerStateRunning && c.state.State != ContainerStateCreated {
|
if c.state.State != ContainerStateRunning {
|
||||||
return errors.Wrapf(ErrCtrStateInvalid, "%q is not running/created, can't pause", c.state.State)
|
return errors.Wrapf(ErrCtrStateInvalid, "%q is not running, can't pause", c.state.State)
|
||||||
}
|
}
|
||||||
if err := c.runtime.ociRuntime.pauseContainer(c); err != nil {
|
if err := c.runtime.ociRuntime.pauseContainer(c); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user