From 5f77fc6c1a95d162af51cc56af4577ca653f53be Mon Sep 17 00:00:00 2001 From: Thomas Stromberg Date: Sat, 16 Feb 2019 07:47:00 -0800 Subject: [PATCH] Only call trySSHPowerOff if we are using hyperv --- pkg/minikube/cluster/cluster.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/minikube/cluster/cluster.go b/pkg/minikube/cluster/cluster.go index 052535fad49f..116822c0055a 100644 --- a/pkg/minikube/cluster/cluster.go +++ b/pkg/minikube/cluster/cluster.go @@ -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) @@ -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")