ceph_manager: add manager.blackhole_kill_osd()

This will suspend disk writes for a couple seconds and then kill the
daemon.  It helps us similute a hardware failure.
This commit is contained in:
Sage Weil 2012-01-31 16:13:59 -08:00
parent d7be77628c
commit e337c4727c

View File

@ -39,6 +39,14 @@ class Thrasher(gevent.Greenlet):
self.dead_osds.append(osd)
self.ceph_manager.kill_osd(osd)
def blackhole_kill_osd(self, osd=None):
if osd is None:
osd = random.choice(self.live_osds)
self.log("Blackholing and then killing osd %s, live_osds are %s"%(str(osd),str(self.live_osds)))
self.live_osds.remove(osd)
self.dead_osds.append(osd)
self.ceph_manager.blackhole_kill_osd(osd)
def revive_osd(self, osd=None):
if osd is None:
osd = random.choice(self.dead_osds)
@ -277,6 +285,12 @@ class CephManager:
def kill_osd(self, osd):
self.ctx.daemons.get_daemon('osd', osd).stop()
def blackhole_kill_osd(self, osd):
self.raw_cluster_cmd('--', 'tell', 'osd.%d' % osd,
'injectargs', '--filestore-blackhole')
time.sleep(2)
self.ctx.daemons.get_daemon('osd', osd).stop()
def revive_osd(self, osd):
self.ctx.daemons.get_daemon('osd', osd).restart()