]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_manager: In Thrasher disable ceph_objectstore_tool tests if old release missing...
authorDavid Zafman <dzafman@redhat.com>
Thu, 23 Oct 2014 17:45:09 +0000 (10:45 -0700)
committerDavid Zafman <dzafman@redhat.com>
Wed, 4 Mar 2015 00:09:52 +0000 (16:09 -0800)
Require ceph-objectstore-tool to be available on all OSD nodes
Log a message when tool is not available

Signed-off-by: David Zafman <dzafman@redhat.com>
(cherry picked from commit f9e088fcbcf06adc62c32f370e90591312491906)

tasks/ceph_manager.py

index ec1115a24e2f85d44a8a14a1a9e617d846d5ec2b..adf961b2d402a9ac0c0908c7b5efd5ad1d5ad5c3 100644 (file)
@@ -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):
         """