Merge "Fix unnecessary for-loop and mis docs"

This commit is contained in:
Jenkins 2017-01-16 16:36:00 +00:00 committed by Gerrit Code Review
commit a97ed0b96a
2 changed files with 14 additions and 14 deletions

View File

@ -1138,19 +1138,19 @@ class RingBuilder(object):
overweight_dev_replica.sort(
key=lambda dr: dr[0]['parts_wanted'])
for dev, replica in overweight_dev_replica:
# this is the most overweight_device holding a replica of this
# part we don't know where it's going to end up - but we'll
# pick it up and hope for the best.
dev['parts_wanted'] += 1
dev['parts'] -= 1
assign_parts[part].append(replica)
self.logger.debug(
"Gathered %d/%d from dev %d [weight forced]",
part, replica, dev['id'])
self._replica2part2dev[replica][part] = NONE_DEV
self._set_part_moved(part)
break
dev, replica = overweight_dev_replica[0]
# this is the most overweight_device holding a replica of this
# part we don't know where it's going to end up - but we'll
# pick it up and hope for the best.
dev['parts_wanted'] += 1
dev['parts'] -= 1
assign_parts[part].append(replica)
self.logger.debug(
"Gathered %d/%d from dev %d [weight forced]",
part, replica, dev['id'])
self._replica2part2dev[replica][part] = NONE_DEV
self._set_part_moved(part)
def _reassign_parts(self, reassign_parts, replica_plan):
"""

View File

@ -773,7 +773,7 @@ class TestRingBuilder(unittest.TestCase):
}
self.assertEqual(zone_histogram, expected)
# After rebalancing two more times, we expect that everything is in a
# After rebalancing one more times, we expect that everything is in a
# good state
rb.rebalance(seed=3)