large commit. refactoring, fio code totally reworker, huge improvenent in test time and results, etc
diff --git a/nodes/discover.py b/nodes/discover.py
index b95d306..62da457 100644
--- a/nodes/discover.py
+++ b/nodes/discover.py
@@ -1,4 +1,5 @@
import logging
+import urlparse
import ceph
import fuel
@@ -9,14 +10,11 @@
logger = logging.getLogger("io-perf-tool")
-def discover(cluster_conf):
- if not cluster_conf:
- logger.error("No nodes configured")
-
+def discover(discover, clusters_info):
nodes_to_run = []
- for cluster, cluster_info in cluster_conf.items():
+ for cluster in discover:
if cluster == "openstack":
-
+ cluster_info = clusters_info["openstack"]
conn = cluster_info['connection']
user, passwd, tenant = parse_creds(conn['creds'])
@@ -39,17 +37,31 @@
cluster_info)
nodes_to_run.extend(os_nodes)
- if cluster == "fuel":
- url = cluster_info['connection'].pop('url')
- creads = cluster_info['connection']
- roles = cluster_info['discover']
+ elif cluster == "fuel" or cluster == "fuel+openstack":
+ cluster_info = clusters_info['fuel']
+ url = cluster_info['url']
+ creds = cluster_info['creds']
+ ssh_creds = cluster_info['ssh_creds']
+ # if user:password format us used
+ if not ssh_creds.startswith("ssh://"):
+ ip_port = urlparse.urlparse(url).netloc
- if isinstance(roles, basestring):
- roles = [roles]
+ if ':' in ip_port:
+ ip = ip_port.split(":")[0]
+ else:
+ ip = ip_port
- nodes_to_run.extend(fuel.discover_fuel_nodes(url, creads, roles))
+ ssh_creds = "ssh://{0}@{1}".format(ssh_creds, ip)
- if cluster == "ceph":
+ env = cluster_info['openstack_env']
+
+ nodes_to_run.extend(fuel.discover_fuel_nodes(url, creds, env))
+
+ elif cluster == "ceph":
+ cluster_info = clusters_info["ceph"]
nodes_to_run.extend(ceph.discover_ceph_nodes(cluster_info))
+ else:
+ msg_templ = "Unknown cluster type in 'discover' parameter: {0!r}"
+ raise ValueError(msg_templ.format(cluster))
return nodes_to_run
diff --git a/nodes/fuel.py b/nodes/fuel.py
index 25476dc..9b1312e 100644
--- a/nodes/fuel.py
+++ b/nodes/fuel.py
@@ -1,18 +1,18 @@
import logging
-import node
+from node import Node
import fuel_rest_api
-from disk_perf_test_tool.utils import parse_creds
logger = logging.getLogger("io-perf-tool")
-def discover_fuel_nodes(root_url, credentials, roles):
+def discover_fuel_nodes(root_url, credentials, cluster_name):
"""Discover Fuel nodes"""
- user, passwd, tenant = parse_creds(credentials['creds'])
-
+ assert credentials.count(':') >= 2
+ user, passwd_tenant = credentials.split(":", 1)
+ passwd, tenant = passwd_tenant.rsplit(":", 1)
creds = dict(
username=user,
password=passwd,
@@ -21,8 +21,14 @@
connection = fuel_rest_api.KeystoneAuth(root_url, creds)
fi = fuel_rest_api.FuelInfo(connection)
+
+ clusters_id = fuel_rest_api.get_cluster_id(connection, cluster_name)
+
nodes = []
- for role in roles:
- nodes.extend(getattr(fi.nodes, role))
- logger.debug("Found %s fuel nodes" % len(fi.nodes))
- return [node.Node(n.ip, n.get_roles()) for n in nodes]
+
+ for node in fi.nodes:
+ if node.cluster == clusters_id:
+ nodes.append(node)
+ res = [Node(n.ip, n.get_roles()) for n in nodes]
+ logger.debug("Found %s fuel nodes for env %r" % (len(res), cluster_name))
+ return res
diff --git a/nodes/openstack.py b/nodes/openstack.py
index ab41f62..d212283 100644
--- a/nodes/openstack.py
+++ b/nodes/openstack.py
@@ -63,9 +63,9 @@
client = Client(version='1.1', **conn_details)
nodes = []
if conf.get('discover'):
- vms_to_discover = conf['discover'].get('vm')
- if vms_to_discover:
- nodes.extend(discover_vms(client, vms_to_discover))
+ # vms_to_discover = conf['discover'].get('vm')
+ # if vms_to_discover:
+ # nodes.extend(discover_vms(client, vms_to_discover))
services_to_discover = conf['discover'].get('nodes')
if services_to_discover:
nodes.extend(discover_services(client, services_to_discover))