]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: make rbd_mirror_thrash inherit from ThrasherGreenlet 67590/head
authorIlya Dryomov <idryomov@gmail.com>
Fri, 27 Feb 2026 14:18:27 +0000 (15:18 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 1 Mar 2026 17:16:36 +0000 (18:16 +0100)
Commit 21b4b89e5280 ("qa/tasks: watchdog terminate thrasher") made it
required for a thrasher to have stop_and_join() method, but the
preceding commit a035b5a22fb8 ("thrashers: standardize stop and join
method names") missed to add it to rbd_mirror_thrash (whether as an
ad-hoc implementation or by way of inheriting from ThrasherGreenlet).
Later on, commit 783f0e3a9903 ("qa: Adding a new class for the
daemonwatchdog to monitor") worsened the issue by expanding the use
of stop_and_join() to all watchdog barks rather than just the case of
a thrasher throwing an exception which is something that practically
never happens.

Fixes: https://tracker.ceph.com/issues/75200
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/tasks/rbd_mirror_thrash.py

index a5b7ae71f54d0cc25067ab6a2c34015185fc3cfd..f153ba47f0b90a5c999fb1c19b7b1d9bc1bf3fae 100644 (file)
@@ -9,18 +9,14 @@ import signal
 import socket
 import time
 
-from gevent import sleep
-from gevent.greenlet import Greenlet
-from gevent.event import Event
-
 from teuthology.exceptions import CommandFailedError
 from teuthology.orchestra import run
-from tasks.thrasher import Thrasher
+from tasks.thrasher import ThrasherGreenlet
 
 log = logging.getLogger(__name__)
 
 
-class RBDMirrorThrasher(ThrasherGreenlet):
+class RBDMirrorThrasher(ThrasherGreenlet):
     """
     RBDMirrorThrasher::
 
@@ -71,7 +67,6 @@ class RBDMirrorThrasher(Thrasher, Greenlet):
 
         self.logger = log
         self.name = 'thrasher.rbd_mirror.[{cluster}]'.format(cluster = cluster)
-        self.stopping = Event()
 
         self.randomize = bool(self.config.get('randomize', True))
         self.max_thrash = int(self.config.get('max_thrash', 1))
@@ -93,9 +88,6 @@ class RBDMirrorThrasher(Thrasher, Greenlet):
         """Write data to logger assigned to this RBDMirrorThrasher"""
         self.logger.info(x)
 
-    def stop(self):
-        self.stopping.set()
-
     def do_thrash(self):
         """
         Perform the random thrashing action
@@ -106,16 +98,14 @@ class RBDMirrorThrasher(Thrasher, Greenlet):
             "kill": 0,
         }
 
-        while not self.stopping.is_set():
+        while not self.is_stopped:
             delay = self.max_thrash_delay
             if self.randomize:
                 delay = random.uniform(self.min_thrash_delay, self.max_thrash_delay)
 
             if delay > 0.0:
                 self.log('waiting for {delay} secs before thrashing'.format(delay=delay))
-                self.stopping.wait(delay)
-                if self.stopping.is_set():
-                    continue
+                self.sleep_unless_stopped(delay)
 
             killed_daemons = []
 
@@ -148,7 +138,7 @@ class RBDMirrorThrasher(Thrasher, Greenlet):
                     delay = random.uniform(0.0, self.max_revive_delay)
 
                 self.log('waiting for {delay} secs before reviving daemons'.format(delay=delay))
-                sleep(delay)
+                self.sleep_unless_stopped(delay)
 
                 for daemon in killed_daemons:
                     self.log('waiting for {label}'.format(label=daemon.id_))