diff options
author | HuanLi <lihuansse@tongji.edu.cn> | 2017-05-24 11:58:00 +0800 |
---|---|---|
committer | HuanLi <lihuansse@tongji.edu.cn> | 2017-05-24 17:50:31 +0800 |
commit | 67b56f734f1d2bb77601c2e75e29fd351f70498e (patch) | |
tree | 5729ea2c470e10ab8db9958f16208a8c7718639f | |
parent | 04edf9e1117096f17136c3a9ff920ddb18b6a678 (diff) |
fix bug: multi monitor
JIRA: YARDSTICK-657
Change-Id: I77223cc43d529828cf3f763529019590c35b2fcb
Signed-off-by: HuanLi <lihuansse@tongji.edu.cn>
-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 |