Commit 45bc19be authored by Federico Simoncelli's avatar Federico Simoncelli

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: 's avatarFederico Simoncelli <fsimonce@redhat.com>
parent aef5c341
...@@ -117,7 +117,11 @@ func (v *OVirtCloud) Zones() (cloudprovider.Zones, bool) { ...@@ -117,7 +117,11 @@ func (v *OVirtCloud) Zones() (cloudprovider.Zones, bool) {
// IPAddress returns the address of a particular machine instance // IPAddress returns the address of a particular machine instance
func (v *OVirtCloud) IPAddress(instance string) (net.IP, error) { 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 // 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) { func getInstancesFromXml(body io.Reader) ([]string, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment