Code Review
/
yardstick.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Yardstick TC082: move sample test case perf.yaml"
[yardstick.git]
/
yardstick
/
benchmark
/
scenarios
/
availability
/
director.py
diff --git
a/yardstick/benchmark/scenarios/availability/director.py
b/yardstick/benchmark/scenarios/availability/director.py
index
104c683
..
f152af0
100644
(file)
--- a/
yardstick/benchmark/scenarios/availability/director.py
+++ b/
yardstick/benchmark/scenarios/availability/director.py
@@
-6,6
+6,7
@@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
+from __future__ import absolute_import
import logging
from yardstick.benchmark.scenarios.availability.monitor import basemonitor
import logging
from yardstick.benchmark.scenarios.availability.monitor import basemonitor
@@
-23,7
+24,7
@@
LOG = logging.getLogger(__name__)
class Director(object):
"""
Director is used to direct a test scenaio
class Director(object):
"""
Director is used to direct a test scenaio
- including the creation of
action players, test result verification
+ including the creation of action players, test result verification
and rollback of actions.
"""
and rollback of actions.
"""
@@
-32,6
+33,7
@@
class Director(object):
# A stack store Rollbacker that will be called after
# all actionplayers finish.
self.executionSteps = []
# A stack store Rollbacker that will be called after
# all actionplayers finish.
self.executionSteps = []
+ self.data = {}
self.scenario_cfg = scenario_cfg
self.context_cfg = context_cfg
self.scenario_cfg = scenario_cfg
self.context_cfg = context_cfg
@@
-41,12
+43,14
@@
class Director(object):
LOG.debug("start init attackers...")
attacker_cfgs = self.scenario_cfg["options"]["attackers"]
self.attackerMgr = baseattacker.AttackerMgr()
LOG.debug("start init attackers...")
attacker_cfgs = self.scenario_cfg["options"]["attackers"]
self.attackerMgr = baseattacker.AttackerMgr()
- self.attackerMgr.init_attackers(attacker_cfgs, nodes)
+ self.data = self.attackerMgr.init_attackers(attacker_cfgs,
+ nodes)
+
# setup monitors
if "monitors" in self.scenario_cfg["options"]:
LOG.debug("start init monitors...")
monitor_cfgs = self.scenario_cfg["options"]["monitors"]
# setup monitors
if "monitors" in self.scenario_cfg["options"]:
LOG.debug("start init monitors...")
monitor_cfgs = self.scenario_cfg["options"]["monitors"]
- self.monitorMgr = basemonitor.MonitorMgr()
+ self.monitorMgr = basemonitor.MonitorMgr(
self.data
)
self.monitorMgr.init_monitors(monitor_cfgs, nodes)
# setup operations
if "operations" in self.scenario_cfg["options"]:
self.monitorMgr.init_monitors(monitor_cfgs, nodes)
# setup operations
if "operations" in self.scenario_cfg["options"]:
@@
-61,7
+65,9
@@
class Director(object):
self.resultCheckerMgr = baseresultchecker.ResultCheckerMgr()
self.resultCheckerMgr.init_ResultChecker(result_check_cfgs, nodes)
self.resultCheckerMgr = baseresultchecker.ResultCheckerMgr()
self.resultCheckerMgr.init_ResultChecker(result_check_cfgs, nodes)
- def createActionPlayer(self, type, key):
+ def createActionPlayer(self, type, key, intermediate_variables=None):
+ if intermediate_variables is None:
+ intermediate_variables = {}
LOG.debug(
"the type of current action is %s, the key is %s", type, key)
if type == ActionType.ATTACKER:
LOG.debug(
"the type of current action is %s, the key is %s", type, key)
if type == ActionType.ATTACKER:
@@
-72,7
+78,8
@@
class Director(object):
return actionplayers.ResultCheckerPlayer(
self.resultCheckerMgr[key])
if type == ActionType.OPERATION:
return actionplayers.ResultCheckerPlayer(
self.resultCheckerMgr[key])
if type == ActionType.OPERATION:
- return actionplayers.OperationPlayer(self.operationMgr[key])
+ return actionplayers.OperationPlayer(self.operationMgr[key],
+ intermediate_variables)
LOG.debug("something run when creatactionplayer")
def createActionRollbacker(self, type, key):
LOG.debug("something run when creatactionplayer")
def createActionRollbacker(self, type, key):
@@
-104,3
+111,8
@@
class Director(object):
while self.executionSteps:
singleStep = self.executionSteps.pop()
singleStep.rollback()
while self.executionSteps:
singleStep = self.executionSteps.pop()
singleStep.rollback()
+
+ def store_result(self, result):
+ LOG.debug("store result ....")
+ if hasattr(self, 'monitorMgr'):
+ self.monitorMgr.store_result(result)