blob: 17aa1e741d20ed29c66804f2d0b66cd10e69f58b [file] [log] [blame]
Yulia Portnova0e64ea22015-03-20 17:27:22 +02001import logging
2
3import openstack
4import ceph
5import fuel
6
7
8logger = logging.getLogger("io-perf-tool")
9
10
11def discover(cluster_conf):
12 if not cluster_conf:
13 logger.error("No nodes configured")
14
15 nodes_to_run = []
16 for cluster, cluster_info in cluster_conf.items():
17 if cluster == "openstack":
18 conn = cluster_info.get('connection')
19 if not conn:
20 logger.error("No connection provided for %s. Skipping"
21 % cluster)
22 continue
23 logger.debug("Discovering openstack nodes "
24 "with connection details: %r" %
25 conn)
26
27 nodes_to_run.extend(openstack.discover_openstack_nodes(
28 conn, cluster_info))
29 if cluster == "fuel":
30 url = cluster_info['connection'].pop('url')
31 creads = cluster_info['connection']
32 roles = cluster_info['discover']
33 if isinstance(roles, basestring):
34 roles = [roles]
35 nodes_to_run.extend(fuel.discover_fuel_nodes(url, creads, roles))
36
37 if cluster == "ceph":
38 nodes_to_run.extend(ceph.discover_ceph_node())
39 return nodes_to_run