server: sandbox_stop: ignore not found sandboxes

This patch matches dockershim behavior

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-05-20 15:14:51 +02:00
parent fb83c7e619
commit a0916b1044
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
2 changed files with 34 additions and 1 deletions

View file

@ -16,7 +16,17 @@ func (s *Server) StopPodSandbox(ctx context.Context, req *pb.StopPodSandboxReque
logrus.Debugf("StopPodSandboxRequest %+v", req)
sb, err := s.getPodSandboxFromRequest(req.PodSandboxId)
if err != nil {
return nil, err
if err == errSandboxIDEmpty {
return nil, err
}
// If the sandbox isn't found we just return an empty response to adhere
// the the CRI interface which expects to not error out in not found
// cases.
resp := &pb.StopPodSandboxResponse{}
logrus.Warnf("could not get sandbox %s, it's probably been stopped already: %v", req.PodSandboxId, err)
return resp, nil
}
podInfraContainer := sb.infraContainer