Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return host IP when using vmware as vm driver. #4255

Merged
merged 2 commits into from
May 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/minikube/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,16 @@ func GetVMHostIP(host *host.Host) (net.IP, error) {
return ip, nil
case "xhyve", "hyperkit":
return net.ParseIP("192.168.64.1"), nil
case "vmware":
vmIPString, err := host.Driver.GetIP()
if err != nil {
return []byte{}, errors.Wrap(err, "Error getting VM IP address")
}
vmIP := net.ParseIP(vmIPString).To4()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be consistent with the others, I think you can just call:

return net.ParseIP(vmIPstring), nil

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