Merge pull request #275 from sboeuf/fix_k8s_shim_killed

virtcontainers: Properly remove the container when shim gets killed
This commit is contained in:
Graham Whaley 2018-04-30 16:51:34 +01:00 committed by GitHub
commit f92d7dd1c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
} }