floating_ip_get_by_address() should return a valid ip that "deleted" is False

Bug #1044108 reported by Jenny Shieh
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Medium
Unassigned

Bug Description

In nova DB there might have the same IP address entries. floating_ip_get_by_address() should only return a valid ip that "deleted" is False. Otherwise, the client will use the invalid IP information to perform actions.

Adrien Cunin (adri2000)
Changed in nova:
status: New → In Progress
assignee: nobody → Adrien Cunin (adri2000)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/12343

Revision history for this message
Mark McLoughlin (markmc) wrote :

Hmm, this bug could really do with instructions on how to reproduce the issue

Revision history for this message
Adrien Cunin (adri2000) wrote :

Jenny, how did you find this bug exactly? did you encounter a problem caused by this bug? or did you just spot that floating_ip_get_by_address() was incorrect while reading through the code?

Revision history for this message
Jenny Shieh (jenny-shieh) wrote : RE: [Bug 1044108] Re: floating_ip_get_by_address() should return a valid ip that "deleted" is False
Download full text (4.4 KiB)

Hi,

Here are the steps to reproduce the issues:

1. nova-manage floating create --ip_range=10.0.0.0/24
2. nova-delete floating delete --ip_range=10.0.0.0/24
3. nova-manage floating create --ip_range=10.0.0.0/24
4. nova-delete floating delete --ip_range=10.0.0.0/24
5. nova-manage floating create --ip_range=10.0.0.0/24
6. To check floating_ips table in nova db, there are duplicate entries for the same ip. But the last one is 'deleted'=F.
7. To create an instance - nova boot --flavor 3 --image ......
8. Check floating_ips table in nova db, make sure the floating IP associated with the created instance is assigned to a project and associated with the instance.
9. delete the created instance. Although the deletion is done, but no disaaociate notification.
10. Check "notifications.info" from rabbitMQ console. There is no "network.floating_ip.disassociate" event_type notification sent out from _disassociate_floating_ip().
11. check nova-network.log:

2012-08-22 15:43:17 WARNING nova.network.manager [req-f3daeb86-5d5d-4094-84e6-dbc6276e276f 1edc68fd88bc4fe484b18010a5a74b61 241eff48bec841a793035519a57aa7c6] Address |10.0.0.25| is not allocated
2012-08-22 15:43:17 ERROR nova.rpc.amqp [req-f3daeb86-5d5d-4094-84e6-dbc6276e276f 1edc68fd88bc4fe484b18010a5a74b61 241eff48bec841a793035519a57aa7c6] Exception during message handling
2012-08-22 15:43:17 TRACE nova.rpc.amqp Traceback (most recent call last):
2012-08-22 15:43:17 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova/rpc/amqp.py", line 253, in _process_data
2012-08-22 15:43:17 TRACE nova.rpc.amqp rval = node_func(context=ctxt, **node_args)
2012-08-22 15:43:17 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova/network/manager.py", line 258, in wrapped
2012-08-22 15:43:17 TRACE nova.rpc.amqp return func(self, context, *args, **kwargs)
2012-08-22 15:43:17 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova/network/manager.py", line 384, in deallocate_for_instance
2012-08-22 15:43:17 TRACE nova.rpc.amqp affect_auto_assigned=True)
2012-08-22 15:43:17 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova/network/manager.py", line 258, in wrapped
2012-08-22 15:43:17 TRACE nova.rpc.amqp return func(self, context, *args, **kwargs)
2012-08-22 15:43:17 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova/network/manager.py", line 575, in disassociate_floating_ip
2012-08-22 15:43:17 TRACE nova.rpc.amqp self._floating_ip_owned_by_project(context, floating_ip)
2012-08-22 15:43:17 TRACE nova.rpc.amqp File "/usr/lib/python2.6/site-packages/nova/network/manager.py", line 406, in _floating_ip_owned_by_project
2012-08-22 15:43:17 TRACE nova.rpc.amqp raise exception.NotAuthorized()
2012-08-22 15:43:17 TRACE nova.rpc.amqp NotAuthorized: Not authorized.
2012-08-22 15:43:17 TRACE nova.rpc.amqp

12. To delete all entries in floating_ips table so there is no any entry in the table.
13. recreate floating IP. nova-manage floating create --ip_range=10.0.0.0/24
14. create a instance and delete the instance. You will get "network.floating_ip.disassociate" event_type notification because there is no du...

Read more...

Revision history for this message
Adrien Cunin (adri2000) wrote :

Thanks Jenny.
My proposed fix has been rejected/abandoned, better ideas welcome.

Changed in nova:
assignee: Adrien Cunin (adri2000) → nobody
status: In Progress → Confirmed
Changed in nova:
importance: Undecided → Medium
Revision history for this message
Joe Gordon (jogo) wrote :

based on the comments at https://review.openstack.org/12343 moving this to opinion.

Changed in nova:
status: Confirmed → Opinion
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.