nova-manage : create network crashes when subnet range provided is not enough

Bug #715424 reported by Tushar Patil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Ricardo Carrillo Cruz

Bug Description

If I run network create command with insufficient subnet range, then it crashes in middle. It seems like fixed_ip range check is not implemented.

$/usr/local/bin/nova-manage --flagfile=/etc/nova/nova.conf network create 10.0.0.0/28 2 64

Fixed_ips range:10.0.0.0/28
number of networks=2
network size per network=64

Error Reported on Console
----------------------------------
2011-02-07 11:18:15,879 INFO sqlalchemy.orm.mapper.Mapper [-] (Project|projects) _post_configure_properties() complete
2011-02-07 11:18:16,008 CRITICAL nova.root [-]
(nova.root): TRACE: Traceback (most recent call last):
(nova.root): TRACE: File "/usr/local/bin/nova-manage", line 5, in <module>
(nova.root): TRACE: pkg_resources.run_script('nova==2011.1', 'nova-manage')
(nova.root): TRACE: File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 461, in run_script
(nova.root): TRACE: self.require(requires)[0].run_script(script_name, ns)
(nova.root): TRACE: File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1194, in run_script
(nova.root): TRACE: execfile(script_filename, namespace, namespace)
(nova.root): TRACE: File "/usr/local/lib/python2.6/dist-packages/nova-2011.1-py2.6.egg/EGG-INFO/scripts/nova-manage", line 694, in <module>
(nova.root): TRACE: main()
(nova.root): TRACE: File "/usr/local/lib/python2.6/dist-packages/nova-2011.1-py2.6.egg/EGG-INFO/scripts/nova-manage", line 686, in main
(nova.root): TRACE: fn(*argv)
(nova.root): TRACE: File "/usr/local/lib/python2.6/dist-packages/nova-2011.1-py2.6.egg/EGG-INFO/scripts/nova-manage", line 500, in create
(nova.root): TRACE: vpn_start=int(vpn_start))
(nova.root): TRACE: File "/usr/local/lib/python2.6/dist-packages/nova-2011.1-py2.6.egg/nova/network/manager.py", line 536, in create_networks
(nova.root): TRACE: cidr = "%s/%s" % (fixed_net[start], significant_bits)
(nova.root): TRACE: File "/usr/lib/pymodules/python2.6/IPy.py", line 880, in getitem
(nova.root): TRACE: return IP(IPint.getitem(self, key))
(nova.root): TRACE: File "/usr/lib/pymodules/python2.6/IPy.py", line 561, in getitem
(nova.root): TRACE: raise IndexError?
(nova.root): TRACE: IndexError?
(nova.root): TRACE:

Related branches

Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Low
status: New → Confirmed
Changed in nova:
assignee: nobody → Ricardo Carrillo Cruz (rcc)
Revision history for this message
Thierry Carrez (ttx) wrote :

Ricardo: did you start working on that ? If yes, please set this to "In progress" and link any branch you may have. If not, maybe unassign you to give someone else a chance to take it ?

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Ricardo Carrillo Cruz (rcarrillocruz) wrote :

Stack trace is different from the original bug poster:

root@dormammu-VirtualBox:/home/dormammu/src/nova/lp715424/bin# ./nova-manage network create 10.0.0.0/28 2 64
2011-02-21 21:36:52,452 CRITICAL nova.root [-]
(nova.root): TRACE: Traceback (most recent call last):
(nova.root): TRACE: File "./nova-manage", line 746, in <module>
(nova.root): TRACE: main()
(nova.root): TRACE: File "./nova-manage", line 738, in main
(nova.root): TRACE: fn(*argv)
(nova.root): TRACE: File "./nova-manage", line 532, in create
(nova.root): TRACE: label=label)
(nova.root): TRACE: File "/home/dormammu/src/nova/lp715424/nova/network/manager.py", line 532, in create_networks
(nova.root): TRACE: cidr = "%s/%s" % (fixed_net[start], significant_bits)
(nova.root): TRACE: File "/usr/lib/pymodules/python2.6/IPy.py", line 880, in __getitem__
(nova.root): TRACE: return IP(IPint.__getitem__(self, key))
(nova.root): TRACE: File "/usr/lib/pymodules/python2.6/IPy.py", line 561, in __getitem__
(nova.root): TRACE: raise IndexError
(nova.root): TRACE: IndexError
(nova.root): TRACE:
root@dormammu-VirtualBox:/home/dormammu/src/nova/lp715424/bin# ./nova-manage network list
network netmask start address DNS
10.0.0.0/27 255.255.255.224 10.0.0.3 None
10.0.0.0/26 255.255.255.192 10.0.0.3 None
10.0.0.0/26 255.255.255.192 10.0.0.3 None
10.0.0.0/24 255.255.255.0 10.0.0.3 None
10.0.1.0/24 255.255.255.0 10.0.1.3 None
10.0.0.0/26 255.255.255.192 10.0.0.3 None
10.0.0.0/26 255.255.255.192 10.0.0.3 None
10.0.0.0/26 255.255.255.192 10.0.0.3 None

Anyways, truth is the networks are added despite the trace, we need to check for overlapping existing networks.

Revision history for this message
Ricardo Carrillo Cruz (rcarrillocruz) wrote :

Dig into IPy documentation, looks like IP.len() might do the trick, that gives the amount of hosts for a given CIDR network.
For example:

>>> ip = IPy.IP("10.0.0.0/28")
>>> print ip.len()
16

It would be a matter of making sure fixed_net.len() can fit num_networks * network_size .

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → 2011.2
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.