From 5f11cb9f55aa0529fddfe916a2976a9aa5b4c08f Mon Sep 17 00:00:00 2001 From: rexlee8776 Date: Tue, 24 Jul 2018 04:17:45 +0000 Subject: the recovery action of "baremetal down" should be triggered mandatory YARDSTICK-1222 has made attacker recover only when the sla not pass. But for baremetal down test case, the node need to power on even the sla pass. TODO: Make attacker can support mandatory recover in some situation. JIRA: YARDSTICK-1337 Change-Id: Ib567b9b9025e5ee421ea47140c468537ad16f090 Signed-off-by: rexlee8776 --- .../benchmark/scenarios/availability/attacker/attacker_baremetal.py | 4 +++- yardstick/benchmark/scenarios/availability/attacker/baseattacker.py | 1 + yardstick/benchmark/scenarios/availability/serviceha.py | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'yardstick/benchmark/scenarios') diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py index 979e3ab14..77efe0dae 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py +++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_baremetal.py @@ -23,7 +23,7 @@ def _execute_shell_command(command, stdin=None): output = [] try: output = subprocess.check_output(command, stdin=stdin, shell=True) - except Exception: + except Exception: # pylint: disable=broad-except exitcode = -1 LOG.error("exec command '%s' error:\n ", command, exc_info=True) @@ -34,6 +34,8 @@ class BaremetalAttacker(BaseAttacker): __attacker_type__ = 'bare-metal-down' def setup(self): + # baremetal down need to recover even sla pass + self.mandatory = True LOG.debug("config:%s context:%s", self._config, self._context) host = self._context.get(self._config['host'], None) diff --git a/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py b/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py index d67a16b98..7871cc918 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py +++ b/yardstick/benchmark/scenarios/availability/attacker/baseattacker.py @@ -63,6 +63,7 @@ class BaseAttacker(object): self.data = {} self.setup_done = False self.intermediate_variables = {} + self.mandatory = False @staticmethod def get_attacker_cls(attacker_cfg): diff --git a/yardstick/benchmark/scenarios/availability/serviceha.py b/yardstick/benchmark/scenarios/availability/serviceha.py index 7f976fdbc..fdfe7cbbe 100755 --- a/yardstick/benchmark/scenarios/availability/serviceha.py +++ b/yardstick/benchmark/scenarios/availability/serviceha.py @@ -88,9 +88,9 @@ class ServiceHA(base.Scenario): def teardown(self): """scenario teardown""" - # only recover when sla not pass - if not self.sla_pass: - for attacker in self.attackers: + # recover when mandatory or sla not pass + for attacker in self.attackers: + if attacker.mandatory or not self.sla_pass: attacker.recover() -- cgit 1.2.3-korg