From 45bc19beb5edde2c4630cb91aa3e7bb744ae1fbd Mon Sep 17 00:00:00 2001 From: Federico Simoncelli Date: Wed, 11 Feb 2015 17:00:32 -0500 Subject: [PATCH] ovirt: fix IPAddress lookup implementation The ovirt instance is reported using its hostname. The IPAddress implementation should lookup the ip (instead of parsing it as if it was already an address). Signed-off-by: Federico Simoncelli --- pkg/cloudprovider/ovirt/ovirt.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cloudprovider/ovirt/ovirt.go b/pkg/cloudprovider/ovirt/ovirt.go index ae25d662a21..187da1eddfe 100644 --- a/pkg/cloudprovider/ovirt/ovirt.go +++ b/pkg/cloudprovider/ovirt/ovirt.go @@ -117,7 +117,11 @@ func (v *OVirtCloud) Zones() (cloudprovider.Zones, bool) { // IPAddress returns the address of a particular machine instance func (v *OVirtCloud) IPAddress(instance string) (net.IP, error) { // since the instance now is the IP in the ovirt env, this is trivial no-op - return net.ParseIP(instance), nil + ip, err := net.LookupIP(instance) + if err != nil || len(ip) < 1 { + return nil, fmt.Errorf("cannot find ip address for: %s", instance) + } + return ip[0], nil } func getInstancesFromXml(body io.Reader) ([]string, error) {