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 committed Aug 13, 2019
1 parent 9ea469b commit b58ab66
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 @@ -93,6 +93,8 @@ type qemu struct {
ctx context.Context

nvdimmCount int

stopped bool
}

const (
Expand Down Expand Up @@ -835,8 +837,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 b58ab66

Please sign in to comment.