Skip to content

Commit

Permalink
Merge pull request #3702 from tstromberg/poweroff-not-so-great
Browse files Browse the repository at this point in the history
Only call trySSHPowerOff if we are using hyperv
  • Loading branch information
tstromberg authored Feb 16, 2019
2 parents e801b47 + 5f77fc6 commit 181446c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,8 @@ func StartHost(api libmachine.API, config cfg.MachineConfig) (*host.Host, error)
return h, nil
}

// tryPowerOff runs the poweroff command on the guest VM to speed up deletion
func tryPowerOff(h *host.Host) {
if h.Driver.DriverName() == "none" {
return
}
// trySSHPowerOff runs the poweroff command on the guest VM to speed up deletion
func trySSHPowerOff(h *host.Host) {
s, err := h.Driver.GetState()
if err != nil {
glog.Warningf("unable to get state: %v", err)
Expand Down Expand Up @@ -177,7 +174,11 @@ func DeleteHost(api libmachine.API) error {
if err != nil {
return errors.Wrap(err, "load")
}
tryPowerOff(host)
// This is slow if SSH is not responding, but HyperV hangs otherwise, See issue #2914
if host.Driver.DriverName() == "hyperv" {
trySSHPowerOff(host)
}

console.OutStyle("deleting-host", "Deleting %q from %s ...", cfg.GetMachineName(), host.DriverName)
if err := host.Driver.Remove(); err != nil {
return errors.Wrap(err, "host remove")
Expand Down

0 comments on commit 181446c

Please sign in to comment.