Yulia Portnova | 21289b2 | 2015-03-18 15:21:43 +0200 | [diff] [blame] | 1 | import node |
Yulia Portnova | 3556a06 | 2015-03-17 16:30:11 +0200 | [diff] [blame] | 2 | import fuel_rest_api |
Yulia Portnova | 0e64ea2 | 2015-03-20 17:27:22 +0200 | [diff] [blame] | 3 | import logging |
Yulia Portnova | 3556a06 | 2015-03-17 16:30:11 +0200 | [diff] [blame] | 4 | |
| 5 | |
Yulia Portnova | 0e64ea2 | 2015-03-20 17:27:22 +0200 | [diff] [blame] | 6 | logger = logging.getLogger("io-perf-tool") |
| 7 | |
| 8 | |
| 9 | def discover_fuel_nodes(root_url, credentials, roles): |
Yulia Portnova | 3556a06 | 2015-03-17 16:30:11 +0200 | [diff] [blame] | 10 | """Discover Fuel nodes""" |
| 11 | connection = fuel_rest_api.KeystoneAuth(root_url, credentials) |
| 12 | fi = fuel_rest_api.FuelInfo(connection) |
Yulia Portnova | 0e64ea2 | 2015-03-20 17:27:22 +0200 | [diff] [blame] | 13 | 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] |