From 19289725c8cf8a6836526508b2d55dad8de38c83 Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Fri, 20 Jan 2017 16:55:22 -0500 Subject: [PATCH] qa: handle thrashing ranks with holes During the course of thrashing max_mds, the ranks assigned to MDSs may develop holes. This causes the thrasher to try to wrongly deactivate ranks that are not assigned. Signed-off-by: Patrick Donnelly --- qa/tasks/mds_thrash.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qa/tasks/mds_thrash.py b/qa/tasks/mds_thrash.py index f1db6ac8db1a7..854505428c8cc 100644 --- a/qa/tasks/mds_thrash.py +++ b/qa/tasks/mds_thrash.py @@ -228,8 +228,9 @@ class MDSThrasher(Greenlet): stats['max_mds'] += 1 # Now randomly deactivate mds if we shrank - for rank in random.sample(range(1, max_mds), max(0, max_mds-new_max_mds)): - self.fs.deactivate(rank) + 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.fs.deactivate(target['rank']) stats['deactivate'] += 1 status = self.wait_for_stable()[0] -- 2.39.5