From 8138cd51986c471db6d86c715adcd286f19a6cd0 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Fri, 27 Sep 2019 09:09:00 +0530 Subject: [PATCH] qa/tasks: Better handling of thrasher names and __init__ calls Fixes: https://tracker.ceph.com/issues/42062 Fixes: https://tracker.ceph.com/issues/42478 Signed-off-by: Jos Collin --- qa/tasks/ceph_manager.py | 3 ++- qa/tasks/daemonwatchdog.py | 2 +- qa/tasks/mds_thrash.py | 4 +++- qa/tasks/mon_thrash.py | 3 ++- qa/tasks/rbd_mirror_thrash.py | 3 ++- qa/tasks/thrasher.py | 13 +++++++++++-- 6 files changed, 21 insertions(+), 7 deletions(-) diff --git a/qa/tasks/ceph_manager.py b/qa/tasks/ceph_manager.py index a635af3de50..df395b5c7a0 100644 --- a/qa/tasks/ceph_manager.py +++ b/qa/tasks/ceph_manager.py @@ -106,7 +106,8 @@ class OSDThrasher(Thrasher): Object used to thrash Ceph """ def __init__(self, manager, config, logger): - super(OSDThrasher, self).__init__() + Thrasher.__init__(self, "OSDThrasher") + self.ceph_manager = manager self.cluster = manager.cluster self.ceph_manager.wait_for_clean() diff --git a/qa/tasks/daemonwatchdog.py b/qa/tasks/daemonwatchdog.py index 1c54d3b622e..b0212db1a00 100644 --- a/qa/tasks/daemonwatchdog.py +++ b/qa/tasks/daemonwatchdog.py @@ -107,7 +107,7 @@ class DaemonWatchdog(Greenlet): for thrasher in self.thrashers: if thrasher.exception is not None: - self.log("thrasher on fs.{name} failed".format(name=thrasher.fs.name)) + self.log("{name} failed".format(name=thrasher.name)) bark = True if bark: diff --git a/qa/tasks/mds_thrash.py b/qa/tasks/mds_thrash.py index e5d86e65b5d..c3d64139ca2 100644 --- a/qa/tasks/mds_thrash.py +++ b/qa/tasks/mds_thrash.py @@ -98,7 +98,8 @@ class MDSThrasher(Greenlet, Thrasher): """ def __init__(self, ctx, manager, config, fs, max_mds): - super(MDSThrasher, self).__init__() + Greenlet.__init__(self) + Thrasher.__init__(self, "MDSThrasher") self.config = config self.ctx = ctx @@ -416,6 +417,7 @@ def task(ctx, config): for fs in status.get_filesystems(): thrasher = MDSThrasher(ctx, manager, config, Filesystem(ctx, fs['id']), fs['mdsmap']['max_mds']) + thrasher.name = thrasher.name + " on fs." + thrasher.fs.name thrasher.start() ctx.ceph[config['cluster']].thrashers.append(thrasher) diff --git a/qa/tasks/mon_thrash.py b/qa/tasks/mon_thrash.py index ed0940c4ebf..191b2809d8d 100644 --- a/qa/tasks/mon_thrash.py +++ b/qa/tasks/mon_thrash.py @@ -86,7 +86,8 @@ class MonitorThrasher(Thrasher): - mon/workloadgen.sh """ def __init__(self, ctx, manager, config, logger): - super(MonitorThrasher, self).__init__() + Thrasher.__init__(self, "MonitorThrasher") + self.ctx = ctx self.manager = manager self.manager.wait_for_clean() diff --git a/qa/tasks/rbd_mirror_thrash.py b/qa/tasks/rbd_mirror_thrash.py index fceb5cfeb98..fa1e043ed31 100644 --- a/qa/tasks/rbd_mirror_thrash.py +++ b/qa/tasks/rbd_mirror_thrash.py @@ -64,7 +64,8 @@ class RBDMirrorThrasher(Greenlet, Thrasher): """ def __init__(self, ctx, config, cluster, daemons): - super(RBDMirrorThrasher, self).__init__() + Greenlet.__init__(self) + Thrasher.__init__(self, "RBDMirrorThrasher") self.ctx = ctx self.config = config diff --git a/qa/tasks/thrasher.py b/qa/tasks/thrasher.py index fc783eaa697..f974745cbd0 100644 --- a/qa/tasks/thrasher.py +++ b/qa/tasks/thrasher.py @@ -3,9 +3,10 @@ Thrasher base class """ class Thrasher(object): - def __init__(self): + def __init__(self, n): super(Thrasher, self).__init__() - self.exception = None + self._exception = None + self._name = n @property def exception(self): @@ -14,3 +15,11 @@ class Thrasher(object): @exception.setter def exception(self, e): self._exception = e + + @property + def name(self): + return self._name + + @name.setter + def name(self, n): + self._name = n -- 2.39.5