ignore storage.ErrNotAContainer
@@ -18,6 +18,7 @@ import (
imageTypes "github.com/containers/image/v5/types"
"github.com/containers/storage/pkg/idtools"
+ storageTypes "github.com/containers/storage/types"
"github.com/cri-o/cri-o/internal/hostport"
"github.com/cri-o/cri-o/internal/lib"
"github.com/cri-o/cri-o/internal/lib/sandbox"
@@ -202,7 +203,7 @@ func (s *Server) restore(ctx context.Context) []string {
}
log.Warnf(ctx, "could not restore sandbox %s container %s: %v", metadata.PodID, sbID, err)
for _, n := range names[sbID] {
- if err := s.Store().DeleteContainer(n); err != nil {
+ if err := s.Store().DeleteContainer(n); err != nil && err != storageTypes.ErrNotAContainer {
log.Warnf(ctx, "unable to delete container %s: %v", n, err)
}
// Release the infra container name and the pod name for future use
@@ -217,7 +218,7 @@ func (s *Server) restore(ctx context.Context) []string {
for k, v := range podContainers {
if v.PodID == sbID {
for _, n := range names[k] {
- if err := s.Store().DeleteContainer(n); err != nil {
+ if err := s.Store().DeleteContainer(n); err != nil && err != storageTypes.ErrNotAContainer {
log.Warnf(ctx, "unable to delete container %s: %v", n, err)
}
// Release the container name for future use
@@ -242,7 +243,7 @@ func (s *Server) restore(ctx context.Context) []string {
}
log.Warnf(ctx, "Could not restore container %s: %v", containerID, err)
for _, n := range names[containerID] {
- if err := s.Store().DeleteContainer(n); err != nil {
+ if err := s.Store().DeleteContainer(n); err != nil && err != storageTypes.ErrNotAContainer {
log.Warnf(ctx, "Unable to delete container %s: %v", n, err)
}
// Release the container name
