1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-09-04 18:30:03 +00:00

shimv2: cleanup container if not found

Shutdown API relies on it being cleaned up in order to proceed.
Otherwise it fails silently and shimv2 process never quits.

This can be triggered by killing the vmm while pod is running.

Fixes: 
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao
2019-12-11 06:06:11 -08:00
parent 743309cdc9
commit 6eae033f48

@@ -17,11 +17,11 @@ import (
)
func deleteContainer(ctx context.Context, s *service, c *container) error {
if !c.cType.IsSandbox() {
status, err := s.sandbox.StatusContainer(c.id)
if err != nil {
return err
}
status, err := s.sandbox.StatusContainer(c.id)
if err != nil && !isNotFound(err) {
return err
}
if !c.cType.IsSandbox() && err == nil {
if status.State.State != types.StateStopped {
_, err = s.sandbox.StopContainer(c.id, false)
if err != nil {