Skip to content

Commit

Permalink
fix(qemu): Handle non-existent QMP monitor file (#1322)
Browse files Browse the repository at this point in the history
Reviewed-by: Cezar Craciunoiu <[email protected]>
Approved-by: Cezar Craciunoiu <[email protected]>
  • Loading branch information
craciunoiuc authored Feb 28, 2024
2 parents 0f7a4d3 + 8b268b4 commit abc9250
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions machine/qemu/v1alpha1.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,12 @@ func (service *machineV1alpha1Service) List(ctx context.Context, machines *machi
func (service *machineV1alpha1Service) Stop(ctx context.Context, machine *machinev1alpha1.Machine) (*machinev1alpha1.Machine, error) {
qmpClient, err := service.QMPClient(ctx, machine)
if err != nil {
if strings.HasSuffix(err.Error(), "connect: no such file or directory") {
machine.Status.State = machinev1alpha1.MachineStateExited
machine.Status.ExitedAt = time.Now()
return machine, nil
}

return machine, fmt.Errorf("could not stop qemu instance: %v", err)
}

Expand Down

0 comments on commit abc9250

Please sign in to comment.