Skip to content

Commit

Permalink
Merge pull request #10733 from govargo/fix-mount-kvm2
Browse files Browse the repository at this point in the history
Fix the failure of `minikube mount` in case of KVM2
  • Loading branch information
sharifelgamal authored Mar 9, 2021
2 parents 3760bf7 + 9f3cfea commit 9425f6c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/minikube/cluster/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,17 @@ func HostIP(host *host.Host, clusterName string) (net.IP, error) {
}
return net.ParseIP(ip), nil
case driver.KVM2:
ip, err := host.Driver.GetIP()
// `host.Driver.GetIP` returns dhcp lease info for a given network(=`virsh net-dhcp-leases minikube-net`)
vmIPString, err := host.Driver.GetIP()
if err != nil {
return []byte{}, errors.Wrap(err, "Error getting VM/Host IP address")
}
return net.ParseIP(ip), nil
vmIP := net.ParseIP(vmIPString).To4()
if vmIP == nil {
// We need the network ip address for minikube-net. It's the start address of the returned subnet.
return []byte{}, errors.Wrap(err, "Error converting VM/Host IP address to IPv4 address")
}
return net.IPv4(vmIP[0], vmIP[1], vmIP[2], byte(1)), nil
case driver.HyperV:
v := reflect.ValueOf(host.Driver).Elem()
var hypervVirtualSwitch string
Expand Down

0 comments on commit 9425f6c

Please sign in to comment.