Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.

Commit 22d4823

Browse files
committed
virtcontainers: fix delete sandbox failed problem
fixes: #2882 reason: If error happens after container create and before sandbox updateResouce in the `CreateContainer()`, then delete sandbox forcefully will return error because s.config.Containers config not flushed into persist store. Signed-off-by: jiangpengfei <[email protected]>
1 parent bdcd2dd commit 22d4823

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

virtcontainers/sandbox.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,10 @@ func (s *Sandbox) CreateContainer(contConfig ContainerConfig) (VCContainer, erro
11641164
if len(s.config.Containers) > 0 {
11651165
// delete container config
11661166
s.config.Containers = s.config.Containers[:len(s.config.Containers)-1]
1167+
// need to flush change to persist storage
1168+
if newErr := s.storeSandbox(); newErr != nil {
1169+
s.Logger().WithError(newErr).Error("Fail to flush s.config.Containers change into sandbox store")
1170+
}
11671171
}
11681172
}
11691173
}()

0 commit comments

Comments
 (0)