pod/container name should be released when create failed

Signed-off-by: Crazykev <crazykev@zju.edu.cn>
This commit is contained in:
Crazykev 2016-10-11 20:19:51 +08:00
parent 96cc03ccd9
commit f6536bf30e
3 changed files with 8 additions and 6 deletions

View file

@ -93,6 +93,7 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
containerDir := filepath.Join(s.runtime.ContainerDir(), containerID)
defer func() {
if err != nil {
s.releaseContainerName(containerName)
err1 := os.RemoveAll(containerDir)
if err1 != nil {
logrus.Warnf("Failed to cleanup container directory: %v")