]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph_manager: test [test-]reweight-by-(utilization|pg)
authorSamuel Just <sjust@redhat.com>
Thu, 28 Apr 2016 22:41:43 +0000 (15:41 -0700)
committerSamuel Just <sjust@redhat.com>
Fri, 29 Apr 2016 22:11:19 +0000 (15:11 -0700)
Fixes: http://tracker.ceph.com/issues/15655
Signed-off-by: Samuel Just <sjust@redhat.com>
tasks/ceph_manager.py

index 7321903eab064c9ab50a2bc163dcba153342219f..70c3a72b6a69532255dc0252ac38062eda65e648 100644 (file)
@@ -380,17 +380,34 @@ class Thrasher:
         self.ceph_manager.mark_in_osd(osd)
         self.log("Added osd %s" % (str(osd),))
 
-    def reweight_osd(self, osd=None):
+    def reweight_osd_or_by_util(self, osd=None):
         """
         Reweight an osd that is in
         :param osd: Osd to be marked.
         """
-        if osd is None:
-            osd = random.choice(self.in_osds)
-        val = random.uniform(.1, 1.0)
-        self.log("Reweighting osd %s to %s" % (str(osd), str(val)))
-        self.ceph_manager.raw_cluster_cmd('osd', 'reweight',
-                                          str(osd), str(val))
+        if osd is not None or random.choice([True, False]):
+            if osd is None:
+                osd = random.choice(self.in_osds)
+            val = random.uniform(.1, 1.0)
+            self.log("Reweighting osd %s to %s" % (str(osd), str(val)))
+            self.ceph_manager.raw_cluster_cmd('osd', 'reweight',
+                                              str(osd), str(val))
+        else:
+            # do it several times, the option space is large
+            for i in range(5):
+                options = {
+                    'max_change': random.choice(['0.05', '1.0', '3.0']),
+                    'overage': random.choice(['110', '1000']),
+                    'type': random.choice([
+                        'reweight-by-utilization',
+                        'test-reweight-by-utilization']),
+                }
+                self.log("Reweighting by: %s"%(str(options),))
+                self.ceph_manager.raw_cluster_cmd(
+                    'osd',
+                    options['type'],
+                    options['overage'],
+                    options['max_change'])
 
     def primary_affinity(self, osd=None):
         if osd is None:
@@ -598,7 +615,7 @@ class Thrasher:
             actions.append((self.revive_osd, 1.0,))
         if self.config.get('thrash_primary_affinity', True):
             actions.append((self.primary_affinity, 1.0,))
-        actions.append((self.reweight_osd,
+        actions.append((self.reweight_osd_or_by_util,
                         self.config.get('reweight_osd', .5),))
         actions.append((self.grow_pool,
                         self.config.get('chance_pgnum_grow', 0),))