diff --git a/pkg/minikube/machine/fix.go b/pkg/minikube/machine/fix.go index 13ca5222600c..a35c3eeaf194 100644 --- a/pkg/minikube/machine/fix.go +++ b/pkg/minikube/machine/fix.go @@ -135,26 +135,34 @@ func recreateIfNeeded(api libmachine.API, cc *config.ClusterConfig, n *config.No } } - if serr != constants.ErrMachineMissing { - klog.Warningf("unexpected machine state, will restart: %v", serr) - } + if h.Driver.DriverName() != driver.Generic { + if serr != constants.ErrMachineMissing { + klog.Warningf("unexpected machine state, will restart: %v", serr) + } - if s == state.Running { - if !recreated { - out.T(style.Running, `Updating the running {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + if s == state.Running { + if !recreated { + out.T(style.Running, `Updating the running {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + } + return h, nil } - return h, nil - } - if !recreated { - out.T(style.Restarting, `Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) - } - if err := h.Driver.Start(); err != nil { - MaybeDisplayAdvice(err, h.DriverName) - return h, errors.Wrap(err, "driver start") - } - if err := saveHost(api, h, cc, n); err != nil { - return h, err + if !recreated { + out.T(style.Restarting, `Restarting existing {{.driver_name}} {{.machine_type}} for "{{.cluster}}" ...`, out.V{"driver_name": cc.Driver, "cluster": machineName, "machine_type": machineType}) + } + if err := h.Driver.Start(); err != nil { + MaybeDisplayAdvice(err, h.DriverName) + return h, errors.Wrap(err, "driver start") + } + if err := saveHost(api, h, cc, n); err != nil { + return h, err + } + } else { + if s == state.Running { + out.T(style.Running, `Using the {{.driver_name}} "{{.cluster}}" {{.machine_type}} ...`, out.V{"driver_name": cc.Driver, "cluster": cc.Name, "machine_type": machineType}) + } else { + return h, errors.Errorf("not running") + } } return h, nil diff --git a/pkg/minikube/machine/stop.go b/pkg/minikube/machine/stop.go index 4309a8cdae04..02ffd0f3b005 100644 --- a/pkg/minikube/machine/stop.go +++ b/pkg/minikube/machine/stop.go @@ -55,14 +55,16 @@ func stop(h *host.Host) error { } } - if err := h.Stop(); err != nil { - klog.Infof("stop err: %v", err) - st, ok := err.(mcnerror.ErrHostAlreadyInState) - if ok && st.State == state.Stopped { - klog.Infof("host is already stopped") - return nil + if h.DriverName != driver.Generic { + if err := h.Stop(); err != nil { + klog.Infof("stop err: %v", err) + st, ok := err.(mcnerror.ErrHostAlreadyInState) + if ok && st.State == state.Stopped { + klog.Infof("host is already stopped") + return nil + } + return &retry.RetriableError{Err: errors.Wrap(err, "stop")} } - return &retry.RetriableError{Err: errors.Wrap(err, "stop")} } klog.Infof("duration metric: stop complete within %s", time.Since(start)) return nil