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

Commit

Permalink
qemu: do not try to stop qemu multiple times
Browse files Browse the repository at this point in the history
We've cleaned it up the first time. Future stop will
only fail.

Fixes: #1958
Signed-off-by: Peng Tao <[email protected]>
  • Loading branch information
bergwolf authored and Eric Ernst committed Aug 29, 2019
1 parent 0903639 commit 5737f80
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion virtcontainers/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ type qemu struct {
ctx context.Context

nvdimmCount int

stopped bool
}

const (
Expand Down Expand Up @@ -821,8 +823,16 @@ func (q *qemu) stopSandbox() error {
span, _ := q.trace("stopSandbox")
defer span.Finish()

defer q.cleanupVM()
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()
if err != nil {
Expand Down

0 comments on commit 5737f80

Please sign in to comment.