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 <pdonnell@redhat.com>
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]