mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-07 12:29:56 +00:00
Merge pull request #275 from sboeuf/fix_k8s_shim_killed
virtcontainers: Properly remove the container when shim gets killed
This commit is contained in:
commit
f92d7dd1c1
@ -665,6 +665,16 @@ func (c *Container) stop() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force the container to be killed. For most of the cases, this
|
||||||
|
// should not matter and it should return an error that will be
|
||||||
|
// ignored.
|
||||||
|
// But for the specific case where the shim has been SIGKILL'ed,
|
||||||
|
// the container is still running inside the VM. And this is why
|
||||||
|
// this signal will ensure the container will get killed to match
|
||||||
|
// the state of the shim. This will allow the following call to
|
||||||
|
// stopContainer() to succeed in such particular case.
|
||||||
|
c.sandbox.agent.killContainer(*(c.sandbox), *c, syscall.SIGKILL, true)
|
||||||
|
|
||||||
if err := c.sandbox.agent.stopContainer(*(c.sandbox), *c); err != nil {
|
if err := c.sandbox.agent.stopContainer(*(c.sandbox), *c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user