From 614eef907a0a445941ef50f5dd3aa9247d90be46 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Wed, 17 Jul 2019 04:41:49 +0530 Subject: [PATCH] qa/tasks: add exception in do_thrash() Fixes the bug during DaemonWatchdog testing: Traceback (most recent call last): File "/home/teuthworker/src/github.com_ceph_ceph-c_wip-daemonwatchdog-testing13/qa/tasks/daemonwatchdog.py", line 38, in _run self.watch() File "/home/teuthworker/src/github.com_ceph_ceph-c_wip-daemonwatchdog-testing13/qa/tasks/daemonwatchdog.py", line 112, in watch if thrasher.e is not None: AttributeError: MonitorThrasher instance has no attribute 'e' Signed-off-by: Jos Collin --- qa/tasks/mon_thrash.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qa/tasks/mon_thrash.py b/qa/tasks/mon_thrash.py index d264e8bcf8a..dc1866a2c6a 100644 --- a/qa/tasks/mon_thrash.py +++ b/qa/tasks/mon_thrash.py @@ -89,6 +89,7 @@ class MonitorThrasher: self.manager = manager self.manager.wait_for_clean() + self.e = None self.stopping = False self.logger = logger self.config = config @@ -220,6 +221,19 @@ class MonitorThrasher: return m def do_thrash(self): + """ + _do_thrash() wrapper. + """ + try: + self._do_thrash() + except Exception as e: + # See _run exception comment for MDSThrasher + self.e = e + self.logger.exception("exception:") + # Allow successful completion so gevent doesn't see an exception. + # The DaemonWatchdog will observe the error and tear down the test. + + def _do_thrash(self): """ Continuously loop and thrash the monitors. """ -- 2.39.5