IndexError: Index out of range error is observed for creating multiple networks with CIDR_v6

Bug #821048 reported by Rohit Karajgi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Jason Kölker

Bug Description

I am trying to run up a unit test that tries to create multiple (>1) networks having an IPv6 CIDR.
While doing so, it raises "IndexError: index out range for address range size!".
This specific use case is in module nova.network.manager, NetworkManager class's create_networks method.
Parameter values: num_networks = 2 (or more) and arbitrary value for cidr_v6 (say 2001:db8::/64)

Trunk Revision: 1370

Traceback (most recent call last):
  File "/home/rohit/nova/diablo/network_unittests/nova/tests/test_network.py", line 537, in test_create_networks_with_ipv6_multiple_networks
    vpn_start=9999)
  File "/home/rohit/nova/diablo/network_unittests/nova/network/manager.py", line 655, in create_networks
    cidr_v6 = '%s/%s' % (fixed_net_v6[start_v6],
  File "/usr/lib/pymodules/python2.6/netaddr/ip/__init__.py", line 917, in __getitem__
    raise IndexError('index out range for address range size!')
IndexError: index out range for address range size!

I think the list is trying to subscript a very large integer index.
line #624: network_size_v6 = 1 << 64 (which is equal to 18446744073709551616)

While calculating start_v6 = index * network_size_v6 , For index = 1 , start_v6 = 18446744073709551616
hence fixed_net_v6[start_v6] tries to access an out of range index, i.e fixed_net_v6[18446744073709551616]

Related branches

Revision history for this message
Jason Kölker (jason-koelker) wrote :

This will be fixed with my new create_networks I'm working on for this other bug. It will use netaddr's built in subnetting/iterating.

Changed in nova:
assignee: nobody → Jason Kölker (jason-koelker)
Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Medium
status: New → In Progress
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → diablo-4
Thierry Carrez (ttx)
Changed in nova:
milestone: diablo-4 → 2011.3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.