Yulia Portnova | 0e64ea2 | 2015-03-20 17:27:22 +0200 | [diff] [blame^] | 1 | import logging |
| 2 | |
| 3 | import openstack |
| 4 | import ceph |
| 5 | import fuel |
| 6 | |
| 7 | |
| 8 | logger = logging.getLogger("io-perf-tool") |
| 9 | |
| 10 | |
| 11 | def 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 |