From: Yan, Zheng Date: Tue, 27 Jun 2017 13:45:31 +0000 (+0800) Subject: qa: update thrash max mds testing X-Git-Tag: v12.1.1~146^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8d1828dc604665da43d49f6aad17135ede4f9f0a;p=ceph.git qa: update thrash max mds testing Current monitor only allows deactivating one mds at a time. Besides, the mds to deactivate should have max rank id. Signed-off-by: "Yan, Zheng" --- diff --git a/qa/tasks/mds_thrash.py b/qa/tasks/mds_thrash.py index 8714967b9522..1fcc9fc6a489 100644 --- a/qa/tasks/mds_thrash.py +++ b/qa/tasks/mds_thrash.py @@ -360,15 +360,17 @@ class MDSThrasher(Greenlet): self.fs.set_max_mds(new_max_mds) stats['max_mds'] += 1 - # Now randomly deactivate mds if we shrank - # TODO: it's desirable to deactivate in order. Make config to do random. - targets = filter(lambda r: r['rank'] > 0, status.get_ranks(self.fs.id)) # can't deactivate 0 - for target in random.sample(targets, max(0, max_mds-new_max_mds)): - self.log("deactivating rank %d" % target['rank']) - self.fs.deactivate(target['rank']) - stats['deactivate'] += 1 - - status = self.wait_for_stable()[0] + targets = filter(lambda r: r['rank'] >= new_max_mds, status.get_ranks(self.fs.id)) + if len(targets) > 0: + # deactivate mds in decending order + targets = sorted(targets, key=lambda r: r['rank'], reverse=True) + for target in targets: + self.log("deactivating rank %d" % target['rank']) + self.fs.deactivate(target['rank']) + stats['deactivate'] += 1 + status = self.wait_for_stable()[0] + else: + status = self.wait_for_stable()[0] count = 0 for info in status.get_ranks(self.fs.id):