aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJing Lu <lvjing5@huawei.com>2017-06-02 03:20:26 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-02 03:20:26 +0000
commit5bdc049447e44738f8a0d67228906c07fd94821e (patch)
treed35ccaefa2a8e4e1a6e37715cbbcbc407f3dedcb
parent9a372b8adf618981e4fbfb8d0cb3a48674c65d92 (diff)
parente0d2d7f5fe691da77bb38319319aa7660a3cc85b (diff)
Merge "fix bug: multi monitor" into stable/danubedanube.3.0
-rw-r--r--yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py21
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 3386c5a..d7d1545 100644
--- a/yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py
+++ b/yardstick/benchmark/scenarios/availability/monitor/monitor_multi.py
@@ -48,10 +48,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:
@@ -59,10 +59,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