]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: update thrash max mds testing 15950/head
authorYan, Zheng <zyan@redhat.com>
Tue, 27 Jun 2017 13:45:31 +0000 (21:45 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 27 Jun 2017 14:08:26 +0000 (22:08 +0800)
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" <zyan@redhat.com>
qa/tasks/mds_thrash.py

index 8714967b95229880835be0acdcbf16d707db2a61..1fcc9fc6a4890942d6211bf9e77ca0a04616c99a 100644 (file)
@@ -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):