Skip to content

Commit

Permalink
incusd/instance/qemu: Fix shutdown race
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
  • Loading branch information
stgraber committed Oct 3, 2024
1 parent 3d685a0 commit 25c34a0
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions internal/server/instance/drivers/driver_qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -757,17 +757,8 @@ func (d *qemu) Shutdown(timeout time.Duration) error {
// Wait 500ms for the first event to be received by the guest.
time.Sleep(500 * time.Millisecond)

// Send a second system_powerdown command (required to get Windows to shutdown).
err = monitor.Powerdown()
if err != nil {
if err == qmp.ErrMonitorDisconnect {
op.Done(nil)
return nil
}

op.Done(err)
return err
}
// Attempt to send a second system_powerdown command (required to get Windows to shutdown).
_ = monitor.Powerdown()

d.logger.Debug("Shutdown request sent to instance")

Expand Down

0 comments on commit 25c34a0

Please sign in to comment.