fixes, add complete test suite
diff --git a/nodes/ceph.py b/nodes/ceph.py
index 216f30d..38ce177 100644
--- a/nodes/ceph.py
+++ b/nodes/ceph.py
@@ -1,17 +1,23 @@
""" Collect data about ceph nodes"""
import json
+import logging
+
from node import Node
-from disk_perf_test_tool.ext_libs import sh
+from disk_perf_test_tool.ssh_utils import connect
-def discover_ceph_node():
+logger = logging.getLogger("io-perf-tool")
+
+
+def discover_ceph_node(ip):
""" Return list of ceph's nodes ips """
ips = {}
+ ssh = connect(ip)
- osd_ips = get_osds_ips(get_osds_list())
- mon_ips = get_mons_or_mds_ips("mon")
- mds_ips = get_mons_or_mds_ips("mds")
+ osd_ips = get_osds_ips(ssh, get_osds_list(ssh))
+ mon_ips = get_mons_or_mds_ips(ssh, "mon")
+ mds_ips = get_mons_or_mds_ips(ssh, "mds")
for ip in osd_ips:
url = "ssh://%s" % ip
@@ -28,23 +34,24 @@
return [Node(ip=url, roles=list(roles)) for url, roles in ips.items()]
-def get_osds_list():
+def get_osds_list(ssh):
""" Get list of osds id"""
- return filter(None, sh.ceph.osd.ls().split("\n"))
+ _, chan, _ = ssh.exec_command("ceph osd ls")
+ return filter(None, chan.read().split("\n"))
-def get_mons_or_mds_ips(who):
+def get_mons_or_mds_ips(ssh, who):
""" Return mon ip list
:param who - "mon" or "mds" """
if who == "mon":
- res = sh.ceph.mon.dump()
+ _, chan, _ = ssh.exec_command("ceph mon dump")
elif who == "mds":
- res = sh.ceph.mds.dump()
+ _, chan, _ = ssh.exec_command("ceph mds dump")
else:
raise ValueError(("'%s' in get_mons_or_mds_ips instead" +
"of mon/mds") % who)
- line_res = res.split("\n")
+ line_res = chan.read().split("\n")
ips = set()
for line in line_res:
@@ -60,12 +67,12 @@
return ips
-def get_osds_ips(osd_list):
+def get_osds_ips(ssh, osd_list):
""" Get osd's ips
:param osd_list - list of osd names from osd ls command"""
ips = set()
for osd_id in osd_list:
- res = sh.ceph.osd.find(osd_id)
- ip = json.loads(str(res))["ip"]
+ _, chan, _ = ssh.exec_command("ceph osd find {0}".format(osd_id))
+ ip = json.loads(chan.read())["ip"]
ips.add(ip.split(":")[0])
return ips
diff --git a/nodes/discover.py b/nodes/discover.py
index d36e517..ec98890 100644
--- a/nodes/discover.py
+++ b/nodes/discover.py
@@ -50,5 +50,5 @@
nodes_to_run.extend(fuel.discover_fuel_nodes(url, creads, roles))
if cluster == "ceph":
- nodes_to_run.extend(ceph.discover_ceph_node())
+ nodes_to_run.extend(ceph.discover_ceph_node(cluster_info["ip"]))
return nodes_to_run
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,