diff options
-rwxr-xr-x | yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash | 7 | ||||
-rw-r--r-- | yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py | 21 |
2 files changed, 20 insertions, 8 deletions
diff --git a/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash b/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash index e0491b0d5..a6a3e96ca 100755 --- a/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash +++ b/yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash @@ -16,7 +16,10 @@ set -e process_name=$1 if [ "$process_name" = "keystone" ]; then - killall -9 -u $process_name + killall -9 -u $process_name else - killall -9 $process_name + for pid in `ps aux | grep "/usr/.*/${process_name}" | grep -v grep | grep -v /bin/sh | awk '{print $2}'`; \ + do + kill -9 ${pid} + done fi diff --git a/yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py b/yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py index 8df2ea282..0bd8e6d37 100644 --- a/yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py +++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py @@ -46,10 +46,10 @@ class MultiMonitor(basemonitor.BaseMonitor): for monitor in self.monitors: monitor_result = monitor.result() - monitor_first_outage = monitor_result.get('first_outage', None) - monitor_last_outage = monitor_result.get('last_outage', None) + monitor_first_outage = monitor_result.get('first_outage', 0) + monitor_last_outage = monitor_result.get('last_outage', 0) - if monitor_first_outage is None or monitor_last_outage is None: + if monitor_first_outage == 0 or monitor_last_outage == 0: continue if monitor_first_outage < first_outage: @@ -57,10 +57,19 @@ class MultiMonitor(basemonitor.BaseMonitor): if monitor_last_outage > last_outage: last_outage = monitor_last_outage - LOG.debug("multi monitor result: %f , %f", first_outage, last_outage) + outage_time = ( + last_outage - first_outage if last_outage > first_outage else 0 + ) + LOG.debug("outage_time is: %f", outage_time) + + max_outage_time = 0 + if "max_outage_time" in self._config["sla"]: + max_outage_time = self._config["sla"]["max_outage_time"] + elif "max_recover_time" in self._config["sla"]: + max_outage_time = self._config["sla"]["max_recover_time"] + else: + raise RuntimeError("monitor max_outage_time config is not found") - outage_time = last_outage - first_outage - max_outage_time = self._config["sla"]["max_outage_time"] if outage_time > max_outage_time: LOG.error("SLA failure: %f > %f", outage_time, max_outage_time) return False |