Skip to content

Commit

Permalink
If the driver can't stop the VM, return a fresh status instead of None
Browse files Browse the repository at this point in the history
If we return None here, the CLI will not try to kill the VM. It only
tries to kill it if the return status is Running.
  • Loading branch information
guillaumerose committed Nov 9, 2020
1 parent d8d3999 commit 3335519
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/crc/machine/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,11 @@ func (client *client) Stop() (state.State, error) {

logging.Info("Stopping the OpenShift cluster, this may take a few minutes...")
if err := host.Stop(); err != nil {
return state.None, errors.Wrap(err, "Cannot stop machine")
status, err := host.Driver.GetState()
if err != nil {
logging.Debugf("Cannot get VM status after stopping it: %v", err)
}
return status, errors.Wrap(err, "Cannot stop machine")
}
return host.Driver.GetState()
}
Expand Down

0 comments on commit 3335519

Please sign in to comment.