server: Make RemovePodSandbox idempotent
And in particular make it not fail when removing an already removed sandbox pod. According to the CRI spec: [RemovePodSandbox] is idempotent, and must not return an error if the sandbox has already been removed. We now only print a warning instead of returning an error. We still return an error when the passed pod ID is empty. Fixes #240 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
8547c0dbd9
commit
365c291f1a
2 changed files with 13 additions and 2 deletions
|
@ -18,7 +18,13 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR
|
|||
logrus.Debugf("RemovePodSandboxRequest %+v", req)
|
||||
sb, err := s.getPodSandboxFromRequest(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
if err == errSandboxIDEmpty {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp := &pb.RemovePodSandboxResponse{}
|
||||
logrus.Warnf("could not get sandbox %s, it's probably been removed already: %v", req.GetPodSandboxId(), err)
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
podInfraContainer := sb.infraContainer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue