Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import (
"github.com/pkg/errors"
)

// sync with https://github.com/containers/storage/blob/7fe03f6c765f2adbc75a5691a1fb4f19e56e7071/pkg/truncindex/truncindex.go#L92
const noSuchID = "no such id"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easier to backport this :) I planned on updating the error in main


type orderedMounts []rspec.Mount

// Len returns the number of mounts. Used in sorting.
Expand Down Expand Up @@ -495,6 +498,10 @@ func (s *Server) CreateContainer(ctx context.Context, req *types.CreateContainer
log.Infof(ctx, description)
err := s.CtrIDIndex().Delete(ctr.ID())
if err != nil {
// already deleted
if strings.Contains(err.Error(), noSuchID) {
return nil
}
log.Warnf(ctx, "Couldn't delete ctr id %s from idIndex", ctr.ID())
}
return err
Expand Down
4 changes: 4 additions & 0 deletions server/sandbox_run_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@ func (s *Server) runPodSandbox(ctx context.Context, req *types.RunPodSandboxRequ
log.Infof(ctx, description)
err2 := s.CtrIDIndex().Delete(sbox.ID())
if err2 != nil {
// already deleted
if strings.Contains(err2.Error(), noSuchID) {
return nil
}
log.Warnf(ctx, "Could not delete ctr id %s from idIndex", sbox.ID())
}
return err2
Expand Down