RemovePodSandbox must be idempotent

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-06-01 12:07:03 +02:00
parent 88fb9094d0
commit 6fd1c8957c
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9

View file

@ -8,6 +8,7 @@ import (
"github.com/containers/storage" "github.com/containers/storage"
"github.com/docker/docker/pkg/mount" "github.com/docker/docker/pkg/mount"
"github.com/kubernetes-incubator/cri-o/oci" "github.com/kubernetes-incubator/cri-o/oci"
pkgstorage "github.com/kubernetes-incubator/cri-o/pkg/storage"
"github.com/opencontainers/selinux/go-selinux/label" "github.com/opencontainers/selinux/go-selinux/label"
"golang.org/x/net/context" "golang.org/x/net/context"
pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" pb "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
@ -96,7 +97,7 @@ func (s *Server) RemovePodSandbox(ctx context.Context, req *pb.RemovePodSandboxR
if err := s.storageRuntimeServer.StopContainer(sb.id); err != nil { if err := s.storageRuntimeServer.StopContainer(sb.id); err != nil {
logrus.Warnf("failed to stop sandbox container in pod sandbox %s: %v", sb.id, err) logrus.Warnf("failed to stop sandbox container in pod sandbox %s: %v", sb.id, err)
} }
if err := s.storageRuntimeServer.RemovePodSandbox(sb.id); err != nil { if err := s.storageRuntimeServer.RemovePodSandbox(sb.id); err != nil && err != pkgstorage.ErrInvalidSandboxID {
return nil, fmt.Errorf("failed to remove pod sandbox %s: %v", sb.id, err) return nil, fmt.Errorf("failed to remove pod sandbox %s: %v", sb.id, err)
} }