blob: c82879365bee890ad2e99788cc92f6f4218b4463 [file] [log] [blame]
Yulia Portnova21289b22015-03-18 15:21:43 +02001import node
Yulia Portnova3556a062015-03-17 16:30:11 +02002import fuel_rest_api
Yulia Portnova0e64ea22015-03-20 17:27:22 +02003import logging
Yulia Portnova3556a062015-03-17 16:30:11 +02004
5
Yulia Portnova0e64ea22015-03-20 17:27:22 +02006logger = logging.getLogger("io-perf-tool")
7
8
9def discover_fuel_nodes(root_url, credentials, roles):
Yulia Portnova3556a062015-03-17 16:30:11 +020010 """Discover Fuel nodes"""
11 connection = fuel_rest_api.KeystoneAuth(root_url, credentials)
12 fi = fuel_rest_api.FuelInfo(connection)
Yulia Portnova0e64ea22015-03-20 17:27:22 +020013 nodes = []
14 for role in roles:
15 nodes.extend(getattr(fi.nodes, role))
16 logger.debug("Found %s fuel nodes" % len(fi.nodes))
17 return [node.Node(n.ip, n.get_roles()) for n in nodes]