mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-18 07:58:36 +00:00
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:
parent
22cee2d0cd
commit
6daefdb177
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user