From: Samuel Just Date: Thu, 28 Apr 2016 22:41:43 +0000 (-0700) Subject: ceph_manager: test [test-]reweight-by-(utilization|pg) X-Git-Tag: v11.1.1~58^2^2~144^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=482a12f348fc004bb6c09d8180d32197372ab8af;p=ceph.git ceph_manager: test [test-]reweight-by-(utilization|pg) Fixes: http://tracker.ceph.com/issues/15655 Signed-off-by: Samuel Just --- diff --git a/tasks/ceph_manager.py b/tasks/ceph_manager.py index 7321903eab0..70c3a72b6a6 100644 --- a/tasks/ceph_manager.py +++ b/tasks/ceph_manager.py @@ -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),))