]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_manager: adds a do_sighup method
authorAndrew Schoen <aschoen@redhat.com>
Tue, 28 Jul 2015 19:00:54 +0000 (14:00 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Tue, 28 Jul 2015 19:46:12 +0000 (14:46 -0500)
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 <aschoen@redhat.com>
tasks/ceph_manager.py

index 6e63868d030f287d1358ce0727e9a27e38c6ce46..054abd93890ffe7bb3524cb646b062d8b58365fe 100644 (file)
@@ -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):
         """