Make derivation of Host IP address more generic when using vmware.
parent
53a46251e1
commit
88a14890a8
|
@ -381,7 +381,15 @@ func GetVMHostIP(host *host.Host) (net.IP, error) {
|
||||||
case "xhyve", "hyperkit":
|
case "xhyve", "hyperkit":
|
||||||
return net.ParseIP("192.168.64.1"), nil
|
return net.ParseIP("192.168.64.1"), nil
|
||||||
case "vmware":
|
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:
|
default:
|
||||||
return []byte{}, errors.New("Error, attempted to get host ip address for unsupported driver")
|
return []byte{}, errors.New("Error, attempted to get host ip address for unsupported driver")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue