qemu: Cleanup Vm paths irrespective of Sandbox stop pass/fail

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
This commit is contained in:
Nitesh Konkar 2019-02-20 16:00:26 +05:30 committed by Sudeesh John
parent 22cee2d0cd
commit 6daefdb177

View File

@ -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()
@ -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)