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

View File

@ -773,7 +773,7 @@ class TestRingBuilder(unittest.TestCase):
} }
self.assertEqual(zone_histogram, expected) 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 # good state
rb.rebalance(seed=3) rb.rebalance(seed=3)