mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-30 17:22:33 +00:00
virtcontainers: change container's state to stop asap
container is killed by force, container's state MUST change its state to stop immediately to avoid leaving it in a bad state. fixes #1088 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
5201860bb0
commit
62c393c119
@ -928,6 +928,13 @@ func (c *Container) stop() error {
|
||||
// get failed if the process hasn't exited.
|
||||
c.sandbox.agent.waitProcess(c, c.id)
|
||||
|
||||
// container was killed by force, container MUST change its state
|
||||
// as soon as possible just in case one of below operations fail leaving
|
||||
// the containers in a bad state.
|
||||
if err := c.setContainerState(types.StateStopped); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := c.sandbox.agent.stopContainer(c.sandbox, *c); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -940,7 +947,7 @@ func (c *Container) stop() error {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.setContainerState(types.StateStopped)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Container) enter(cmd types.Cmd) (*Process, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user