Merge pull request #1959 from bergwolf/stopvm

qemu: do not try to stop qemu multiple times
This commit is contained in:
Julio Montes 2019-08-15 08:50:17 -05:00 committed by GitHub
commit de4582eda3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,6 +93,8 @@ type qemu struct {
ctx context.Context ctx context.Context
nvdimmCount int nvdimmCount int
stopped bool
} }
const ( const (
@ -835,8 +837,16 @@ func (q *qemu) stopSandbox() error {
span, _ := q.trace("stopSandbox") span, _ := q.trace("stopSandbox")
defer span.Finish() defer span.Finish()
defer q.cleanupVM()
q.Logger().Info("Stopping Sandbox") q.Logger().Info("Stopping Sandbox")
if q.stopped {
q.Logger().Info("Already stopped")
return nil
}
defer func() {
q.cleanupVM()
q.stopped = true
}()
err := q.qmpSetup() err := q.qmpSetup()
if err != nil { if err != nil {