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

Commit

Permalink
qemu: Cleanup Vm paths irrespective of Sandbox stop pass/fail
Browse files Browse the repository at this point in the history
Sometimes qemu/qmp commands error out and VM files
get left behind on the host filesystem. Clen them up
irrespective of `stopSandbox` succeeds or fails.

Fixes: #1246

Signed-off-by: Nitesh Konkar niteshkonkar@in.ibm.com
  • Loading branch information
nitkon authored and Sudeesh John committed Feb 20, 2019
1 parent 22cee2d commit 6daefdb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions virtcontainers/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ func (q *qemu) stopSandbox() error {
span, _ := q.trace("stopSandbox")
defer span.Finish()

defer q.cleanupVM()
q.Logger().Info("Stopping Sandbox")

err := q.qmpSetup()
Expand All @@ -655,6 +656,11 @@ func (q *qemu) stopSandbox() error {
return err
}

return nil
}

func (q *qemu) cleanupVM() error {

// cleanup vm path
dir := filepath.Join(store.RunVMStoragePath, q.id)

Expand Down

0 comments on commit 6daefdb

Please sign in to comment.