Skip to content

Commit

Permalink
Make derivation of Host IP address more generic when using vmware.
Browse files Browse the repository at this point in the history
  • Loading branch information
ne0h committed May 15, 2019
1 parent 9ff02aa commit a711431
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,15 @@ func GetVMHostIP(host *host.Host) (net.IP, error) {
case "xhyve", "hyperkit":
return net.ParseIP("192.168.64.1"), nil
case "vmware":
return net.ParseIP("192.168.4.1"), nil
vmIPString, err := host.Driver.GetIP()
if err != nil {
return []byte{}, errors.Wrap(err, "Error getting VM IP address")
}
vmIP := net.ParseIP(vmIPString).To4()
if vmIP == nil {
return []byte{}, errors.Wrap(err, "Error converting VM IP address to IPv4 address")
}
return net.IPv4(vmIP[0], vmIP[1], vmIP[2], byte(1)), nil
default:
return []byte{}, errors.New("Error, attempted to get host ip address for unsupported driver")
}
Expand Down

0 comments on commit a711431

Please sign in to comment.