Skip to content
This repository has been archived by the owner on Feb 8, 2021. It is now read-only.

Commit

Permalink
cleanup the sandbox after it exited
Browse files Browse the repository at this point in the history
Signed-off-by: fupan <[email protected]>
  • Loading branch information
lifupan committed Jun 22, 2018
1 parent 29b7d94 commit 57d713a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion daemon/pod/decommission.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ func (p *XPod) ForceQuit() {
}

func (p *XPod) Remove(force bool) error {
var err error

if p.IsRunning() {
if !force {
err := fmt.Errorf("pod is running, cannot be removed")
err = fmt.Errorf("pod is running, cannot be removed")
p.Log(ERROR, err)
return err
}
Expand Down Expand Up @@ -624,6 +625,11 @@ func (p *XPod) decommissionResources() (err error) {
}
}

err = p.sandbox.Delete()
if err != nil {
p.Log(ERROR, "remove sandbox failed: %v", err)
}

p.sandbox = nil

cleanupHosts(p.Id())
Expand Down

0 comments on commit 57d713a

Please sign in to comment.