nova network deallocates fixed IP with non unique field in DB

Bug #1053828 reported by willfu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
High
Unassigned

Bug Description

Tried many diff configurations for openstack network service.
Found Openstack deallocated fixd IP with non unique field in DB table
fixed_ips, whose field name is address.

How to reproduce:
    1.create openstack network 10.0.100.0/24, range 256.
    2.delete this network.
    3.recreate it.
    4.nova delete instance id.
Then the bug fired with exception as below.

2012-09-17 21:59:50 TRACE nova.rpc.amqp Traceback (most recent call last):
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/rpc/amqp.py", line 253, in _process_data
2012-09-17 21:59:50 TRACE nova.rpc.amqp rval = node_func(context=ctxt,
**node_args)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/network/manager.py", line 257, in
wrapped
2012-09-17 21:59:50 TRACE nova.rpc.amqp return func(self, context, *args,
**kwargs)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/network/manager.py", line 379, in
deallocate_for_instance
2012-09-17 21:59:50 TRACE nova.rpc.amqp super(FloatingIP,
self).deallocate_for_instance(context, **kwargs)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/network/manager.py", line 257, in
wrapped
2012-09-17 21:59:50 TRACE nova.rpc.amqp return func(self, context, *args,
**kwargs)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/network/manager.py", line 934, in
deallocate_for_instance
2012-09-17 21:59:50 TRACE nova.rpc.amqp **kwargs)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/network/manager.py", line 230, in
deallocate_fixed_ip
2012-09-17 21:59:50 TRACE nova.rpc.amqp network =
self._get_network_by_id(context, fixed_ip['network_id'])
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/network/manager.py", line 1550, in
_get_network_by_id
2012-09-17 21:59:50 TRACE nova.rpc.amqp return self.db.network_get(context,
network_id)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/db/api.py", line 755, in network_get
2012-09-17 21:59:50 TRACE nova.rpc.amqp return IMPL.network_get(context,
network_id)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/db/sqlalchemy/api.py", line 120, in
wrapper
2012-09-17 21:59:50 TRACE nova.rpc.amqp return f(*args, **kwargs)
2012-09-17 21:59:50 TRACE nova.rpc.amqp File
"/usr/lib/python2.6/site-packages/nova/db/sqlalchemy/api.py", line 1933, in
network_get
2012-09-17 21:59:50 TRACE nova.rpc.amqp if not result:
2012-09-17 21:59:50 TRACE nova.rpc.amqp NetworkNotFound: Network 1 could not be
found.

Revision history for this message
willfu (willfly0620) wrote :

After walking through code, I got the coding solution for this bug.
in /usr/lib/python2.6/site-packages/nova/network/manager.py
    def deallocate_fixed_ip(self, context, address, host, **kwargs):
        """Call the superclass deallocate_fixed_ip if i'm the correct host
        otherwise call to the correct host"""
        fixed_ip = self.db.fixed_ip_get_by_address(context, address)
        network = self._get_network_by_id(context, fixed_ip['network_id'])

The fixed_ip_get_by_address() method should have more sanity check to avoid
this bug.

Changed in nova:
status: New → Confirmed
importance: Undecided → High
tags: added: folsom-rc-potential
Revision history for this message
Vish Ishaya (vishvananda) wrote :

pretty sure this is a duplicate and has been fixed already.

tags: removed: folsom-rc-potential
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.