From 84d24038aafdd2f3f165e7ee28a139a19b737da3 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Tue, 28 Jul 2015 14:00:54 -0500 Subject: [PATCH] ceph_manager: adds a do_sighup method This method runs in a separate greenlet than do_thrash and will pick a random live osd to send a signal.SIGHUP to. There is a config option, sighup_delay, which controls how long to delay between sending the signals. Signed-off-by: Andrew Schoen --- tasks/ceph_manager.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tasks/ceph_manager.py b/tasks/ceph_manager.py index 6e63868d030f2..054abd93890ff 100644 --- a/tasks/ceph_manager.py +++ b/tasks/ceph_manager.py @@ -5,6 +5,7 @@ from cStringIO import StringIO from functools import wraps import contextlib import random +import signal import time import gevent import base64 @@ -112,6 +113,7 @@ class Thrasher: self.clean_wait = self.config.get('clean_wait', 0) self.minin = self.config.get("min_in", 3) self.chance_move_pg = self.config.get('chance_move_pg', 1.0) + self.sighup_delay = self.config.get('sighup_delay') num_osds = self.in_osds + self.out_osds self.max_pgs = self.config.get("max_pgs_per_pool_osd", 1200) * num_osds @@ -135,6 +137,8 @@ class Thrasher: manager.raw_cluster_cmd('--', 'mon', 'tell', '*', 'injectargs', '--mon-osd-down-out-interval 0') self.thread = gevent.spawn(self.do_thrash) + if self.sighup_delay: + self.sighup_thread = gevent.spawn(self.do_sighup) if self.config.get('powercycle') or not self.cmd_exists_on_osds("ceph-objectstore-tool"): self.ceph_objectstore_tool = False self.test_rm_past_intervals = False @@ -425,6 +429,9 @@ class Thrasher: """ self.stopping = True self.thread.get() + if self.sighup_delay: + self.log("joining the do_sighup greenlet") + self.sighup_thread.get() def grow_pool(self): """ @@ -642,6 +649,20 @@ class Thrasher: raise return wrapper + @log_exc + def do_sighup(self): + """ + Loops and sends signal.SIGHUP to a random live osd. + + Loop delay is controlled by the config value sighup_delay. + """ + delay = float(self.sighup_delay) + self.log("starting do_sighup with a delay of {0}".format(delay)) + while not self.stopping: + osd = random.choice(self.live_osds) + self.ceph_manager.signal_osd(osd, signal.SIGHUP) + time.sleep(delay) + @log_exc def do_thrash(self): """ -- 2.39.5