aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2017-01-10 09:13:06 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-01-10 09:13:06 +0000
commit9a02ad7f3b9b7eac2bdc226554ca2efba752ad0d (patch)
treed1111df59f87c559759c9a691c2dd10dc7eaec5c
parent9667f5d35df9caf9a3a8f851c2ce3612fa2ba437 (diff)
parent52e7c7111a45bd9b89cabdeb446f4b50d7c7a07c (diff)
Merge "Yardstick framework concurrent support"
-rw-r--r--yardstick/benchmark/core/task.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/yardstick/benchmark/core/task.py b/yardstick/benchmark/core/task.py
index 397ba00b0..8fb117771 100644
--- a/yardstick/benchmark/core/task.py
+++ b/yardstick/benchmark/core/task.py
@@ -262,7 +262,9 @@ class TaskParser(object): # pragma: no cover
else:
context_cfgs = [{"type": "Dummy"}]
+ name_suffix = '-{}'.format(task_id[:8])
for cfg_attrs in context_cfgs:
+ cfg_attrs['name'] = '{}{}'.format(cfg_attrs['name'], name_suffix)
context_type = cfg_attrs.get("type", "Heat")
if "Heat" == context_type and "networks" in cfg_attrs:
# bugfix: if there are more than one network,
@@ -270,7 +272,7 @@ class TaskParser(object): # pragma: no cover
# the name of netwrok should follow this rule:
# test, test2, test3 ...
# sort network with the length of network's name
- sorted_networks = sorted(cfg_attrs["networks"].keys())
+ sorted_networks = sorted(cfg_attrs["networks"])
# config external_network based on env var
cfg_attrs["networks"][sorted_networks[0]]["external_network"] \
= os.environ.get("EXTERNAL_NETWORK", "net04_ext")
@@ -286,6 +288,13 @@ class TaskParser(object): # pragma: no cover
scenario["tc"] = task_name
scenario["task_id"] = task_id
+ change_server_name(scenario, name_suffix)
+
+ try:
+ change_server_name(scenario['nodes'], name_suffix)
+ except KeyError:
+ pass
+
# TODO we need something better here, a class that represent the file
return cfg["scenarios"], run_in_parallel, meet_precondition
@@ -482,3 +491,21 @@ def check_environment():
if e.errno != errno.EEXIST:
raise
LOG.debug('OPENRC file not found')
+
+
+def change_server_name(scenario, suffix):
+ try:
+ scenario['host'] += suffix
+ except KeyError:
+ pass
+
+ try:
+ scenario['target'] += suffix
+ except KeyError:
+ pass
+
+ try:
+ key = 'targets'
+ scenario[key] = ['{}{}'.format(a, suffix) for a in scenario[key]]
+ except KeyError:
+ pass