fixes, add complete test suite
diff --git a/nodes/openstack.py b/nodes/openstack.py
index 558985d..ab41f62 100644
--- a/nodes/openstack.py
+++ b/nodes/openstack.py
@@ -1,5 +1,7 @@
+import socket
import logging
+
from novaclient.client import Client
import node
@@ -41,11 +43,11 @@
services.extend(client.services.list(binary=s))
host_services_mapping = {}
+
for service in services:
- if host_services_mapping.get(service.host):
- host_services_mapping[service.host].append(service.binary)
- else:
- host_services_mapping[service.host] = [service.binary]
+ ip = socket.gethostbyname(service.host)
+ host_services_mapping[ip].append(service.binary)
+
logger.debug("Found %s openstack service nodes" %
len(host_services_mapping))
return [node.Node(host, services, username=user,