pod/container name should be released when create failed
Signed-off-by: Crazykev <crazykev@zju.edu.cn>
This commit is contained in:
parent
96cc03ccd9
commit
f6536bf30e
3 changed files with 8 additions and 6 deletions
|
@ -104,18 +104,19 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
return nil, fmt.Errorf("pod sandbox (%s) already exists", podSandboxDir)
|
||||
}
|
||||
|
||||
if err = os.MkdirAll(podSandboxDir, 0755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
s.releasePodName(name)
|
||||
if err2 := os.RemoveAll(podSandboxDir); err2 != nil {
|
||||
logrus.Warnf("couldn't cleanup podSandboxDir %s: %v", podSandboxDir, err2)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
if err = os.MkdirAll(podSandboxDir, 0755); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// creates a spec Generator with the default spec.
|
||||
g := generate.New()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue