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: #2345
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

View File

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