)
-def cmd_exists(cmd):
- return subprocess.call("type " + cmd, shell=True,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
-
-
class Thrasher:
"""
Object used to thrash Ceph
self.revive_timeout += 120
self.clean_wait = self.config.get('clean_wait', 0)
self.minin = self.config.get("min_in", 3)
- if cmd_exists("ceph-objectstore-tool"):
- self.ceph_objectstore_tool = self.config.get('ceph_objectstore_tool', False)
- else:
- self.ceph_objectstore_tool = False
self.chance_move_pg = self.config.get('chance_move_pg', 1.0)
num_osds = self.in_osds + self.out_osds
manager.raw_cluster_cmd('--', 'mon', 'tell', '*', 'injectargs',
'--mon-osd-down-out-interval 0')
self.thread = gevent.spawn(self.do_thrash)
+ if self.cmd_exists_on_osds("ceph-objectstore-tool"):
+ self.ceph_objectstore_tool = \
+ self.config.get('ceph_objectstore_tool', False)
+ else:
+ self.ceph_objectstore_tool = False
+ self.log("Unable to test ceph_objectstore_tool, "
+ "not available on all OSD nodes")
+
+ def cmd_exists_on_osds(self, cmd):
+ allremotes = self.ceph_manager.ctx.cluster.only(\
+ teuthology.is_type('osd')).remotes.keys()
+ allremotes = list(set(allremotes))
+ for remote in allremotes:
+ proc = remote.run(args=['type', cmd], check_status=False,
+ stdout=StringIO(), stderr=StringIO())
+ if proc.exitstatus != 0:
+ return False;
+ return True;
def kill_osd(self, osd=None, mark_down=False, mark_out=False):
"""