diff options
author | HuanLi <lihuansse@tongji.edu.cn> | 2017-05-24 11:58:00 +0800 |
---|---|---|
committer | Jing Lu <lvjing5@huawei.com> | 2017-06-01 07:13:52 +0000 |
commit | e0d2d7f5fe691da77bb38319319aa7660a3cc85b (patch) | |
tree | ebf98e5beab9e2018ba943a133bbd6d4cc857005 | |
parent | e1b315fb5fded93c03693ac097b1a749dcc50034 (diff) |
fix bug: multi monitor
JIRA: YARDSTICK-657
Change-Id: I77223cc43d529828cf3f763529019590c35b2fcb
Signed-off-by: HuanLi <lihuansse@tongji.edu.cn>
(cherry picked from commit 67b56f734f1d2bb77601c2e75e29fd351f70498e)
-rw-r--r-- | yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py | 21 |
1 files changed, 15 insertions, 6 deletions
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 |