From: David Zafman Date: Thu, 23 Oct 2014 17:45:09 +0000 (-0700) Subject: ceph_manager: In Thrasher disable ceph_objectstore_tool tests if old release missing... X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4b341832bfab6ddc5e513f82d70cbd5f6936f5a2;p=ceph.git ceph_manager: In Thrasher disable ceph_objectstore_tool tests if old release missing command Require ceph-objectstore-tool to be available on all OSD nodes Log a message when tool is not available Signed-off-by: David Zafman (cherry picked from commit f9e088fcbcf06adc62c32f370e90591312491906) --- diff --git a/tasks/ceph_manager.py b/tasks/ceph_manager.py index ec1115a24e2..adf961b2d40 100644 --- a/tasks/ceph_manager.py +++ b/tasks/ceph_manager.py @@ -58,11 +58,6 @@ def mount_osd_data(ctx, remote, osd): ) -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 @@ -83,10 +78,6 @@ class Thrasher: 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 @@ -111,6 +102,24 @@ class Thrasher: 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): """