Skip to content

Commit

Permalink
Make ip block splitting a bit more self documenting.
Browse files Browse the repository at this point in the history
Change-Id: If1343850d75707bc189ba11b33491361f7f58e29
  • Loading branch information
mikalstill committed Sep 11, 2012
1 parent 608b75e commit 7b24a76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nova/db/sqlalchemy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,15 +734,15 @@ def floating_ip_bulk_create(context, ips):
session.add(model)


def _ip_range_splitter(ips):
"""Yields blocks of IPs no more than 256 elements long."""
def _ip_range_splitter(ips, block_size=256):
"""Yields blocks of IPs no more than block_size elements long."""
out = []
count = 0
for ip in ips:
out.append(ip['address'])
count += 1

if count > 255:
if count > block_size - 1:
yield out
out = []
count = 0
Expand Down

0 comments on commit 7b24a76

Please sign in to comment.