Skip to content

Commit a035b5a

Browse files
committed
thrashers: standardize stop and join method names
Thrashers that do not inherit from ThrasherGreenlet previously used a method called do_join, which combined stop and join functionality. To ensure consistency and clarity, we want all thrashers to use separate stop, join, and stop_and_join methods. This commit renames methods and implements missing stop and stop_and_join methods in thrashers that did not inherit from ThrasherGreenlet. Fixes: https://tracker.ceph.com/issues/66698 Signed-off-by: Nitzan Mordechai <[email protected]>
1 parent 21b4b89 commit a035b5a

File tree

5 files changed

+48
-8
lines changed

5 files changed

+48
-8
lines changed

qa/tasks/ceph_manager.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,11 +870,16 @@ def all_up_in(self):
870870
self.ceph_manager.raw_cluster_cmd('osd', 'primary-affinity',
871871
str(osd), str(1))
872872

873-
def do_join(self):
873+
def stop(self):
874874
"""
875-
Break out of this Ceph loop
875+
Stop the thrasher
876876
"""
877877
self.stopping = True
878+
879+
def join(self):
880+
"""
881+
Break out of this Ceph loop
882+
"""
878883
self.thread.get()
879884
if self.sighup_delay:
880885
self.log("joining the do_sighup greenlet")
@@ -889,6 +894,13 @@ def do_join(self):
889894
self.log("joining the do_noscrub_toggle greenlet")
890895
self.noscrub_toggle_thread.join()
891896

897+
def stop_and_join(self):
898+
"""
899+
Stop and join the thrasher
900+
"""
901+
self.stop()
902+
return self.join()
903+
892904
def grow_pool(self):
893905
"""
894906
Increase the size of the pool

qa/tasks/mon_thrash.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,26 @@ def log(self, x):
157157
"""
158158
self.logger.info(x)
159159

160-
def do_join(self):
160+
def stop(self):
161+
"""
162+
Stop the thrashing process.
163+
"""
164+
self.stopping = True
165+
166+
def join(self):
161167
"""
162168
Break out of this processes thrashing loop.
163169
"""
164170
self.stopping.set()
165171
self.thread.get()
166172

173+
def stop_and_join(self):
174+
"""
175+
Stop the thrashing process and join the thread.
176+
"""
177+
self.stop()
178+
return self.join()
179+
167180
def should_thrash_store(self):
168181
"""
169182
If allowed, indicate that we should thrash a certain percentage of
@@ -450,6 +463,6 @@ def task(ctx, config):
450463
yield
451464
finally:
452465
log.info('joining mon_thrasher')
453-
thrash_proc.do_join()
466+
thrash_proc.stop_and_join()
454467
mons = _get_mons(ctx)
455468
manager.wait_for_mon_quorum_size(len(mons))

qa/tasks/scrub.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def task(ctx, config):
5959
yield
6060
finally:
6161
log.info('joining scrub')
62-
scrub_proc.do_join()
62+
scrub_proc.stop_and_join()
6363

6464
class Scrubber:
6565
"""
@@ -91,11 +91,19 @@ def tmp(x):
9191

9292
self.thread = gevent.spawn(self.do_scrub)
9393

94-
def do_join(self):
95-
"""Scrubbing thread finished"""
94+
def stop(self):
95+
"""Stop scrubbing"""
9696
self.stopping = True
97+
98+
def join(self):
99+
"""Scrubbing thread finished"""
97100
self.thread.get()
98101

102+
def stop_and_join(self):
103+
"""Stop scrubbing thread"""
104+
self.stop()
105+
return self.join()
106+
99107
def do_scrub(self):
100108
"""Perform the scrub operation"""
101109
frequency = self.config.get("frequency", 30)

qa/tasks/thrasher.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def exception(self):
1919
def set_thrasher_exception(self, e):
2020
self._exception = e
2121

22+
def stop(self):
23+
raise NotImplementedError("Subclasses didn't implement this method.")
24+
2225
class ThrasherGreenlet(Thrasher, Greenlet):
2326

2427
class Stopped(Exception): ...
@@ -46,3 +49,7 @@ def sleep_unless_stopped(self, seconds, raise_stopped = True):
4649
if self.is_stopped and raise_stopped:
4750
raise self.Stopped()
4851
return not self.is_stopped
52+
53+
def stop_and_join(self):
54+
self.stop()
55+
return self.join()

qa/tasks/thrashosds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def task(ctx, config):
214214
yield
215215
finally:
216216
log.info('joining thrashosds')
217-
thrash_proc.do_join()
217+
thrash_proc.stop_and_join()
218218
cluster_manager.wait_for_all_osds_up()
219219
cluster_manager.flush_all_pg_stats()
220220
cluster_manager.wait_for_recovery(config.get('timeout', 360))

0 commit comments

Comments
 (0)