Skip to content

Commit

Permalink
Retry on SSH connectivity check
Browse files Browse the repository at this point in the history
  • Loading branch information
hypnoglow committed Nov 7, 2019
1 parent a583cbe commit b61dd14
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cmd/minikube/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,18 @@ func validateNetwork(h *host.Host, r command.Runner) string {

func trySSH(h *host.Host, ip string) {
sshAddr := fmt.Sprintf("%s:22", ip)
conn, err := net.Dial("tcp", sshAddr)
if err != nil {

dial := func() (err error) {
d := net.Dialer{Timeout: 3 * time.Second}
conn, err := d.Dial("tcp", sshAddr)
if err != nil {
return err
}
_ = conn.Close()
return nil
}

if err := retry.Expo(dial, time.Second, 13*time.Second); err != nil {
exit.WithCodeT(exit.IO, `minikube is unable to connect to the VM: {{.error}}
This is likely due to one of two reasons:
Expand All @@ -1046,7 +1056,6 @@ Suggested workarounds:
- Restart or reinstall {{.hypervisor}}
- Use an alternative --vm-driver`, out.V{"error": err, "hypervisor": h.Driver.DriverName(), "ip": ip})
}
defer conn.Close()
}

func tryLookup(r command.Runner) {
Expand Down

0 comments on commit b61dd14

Please sign in to comment.