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
8 changes: 8 additions & 0 deletions server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,14 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
if err := s.createContainerPlatform(newContainer, sb.CgroupParent()); err != nil {
return nil, err
}
defer func() {
if retErr != nil {
log.Infof(ctx, "createCtr: removing container ID %s from runtime", ctr.ID())
if err2 := s.Runtime().DeleteContainer(newContainer); err2 != nil {
log.Warnf(ctx, "failed to delete container in runtime %s: %v", ctr.ID(), err)
}
}
}()

if err := s.ContainerStateToDisk(newContainer); err != nil {
log.Warnf(ctx, "unable to write containers %s state to disk: %v", newContainer.ID(), err)
Expand Down
4 changes: 2 additions & 2 deletions test/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ function retry() {
local i

for ((i = 0; i < attempts; i++)); do
if run "$@"; then
if "$@"; then
return 0
fi
sleep "$delay"
done

echo "Command \"$*\" failed $attempts times. Output: $output"
echo "Command \"$*\" failed $attempts times"
false
}

Expand Down