Race condition for auto assigned addresses in Nova networking

Bug #1190585 reported by Phil Day
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Jiajun Liu

Bug Description

The allocate_for_instance() code in Nova networking FlatDHCPManager for auto assigning a floating IP splits the allocation and setting of the auto assigned column into two steps:

 if CONF.auto_assign_floating_ip:
            # allocate a floating ip
            floating_address = self.allocate_floating_ip(context, project_id,
                True)
            LOG.debug(_("floating IP allocation for instance "
                        "|%(floating_address)s|") % locals(),
                        instance_uuid=instance_uuid, context=context)
            # set auto_assigned column to true for the floating ip
            self.db.floating_ip_set_auto_assigned(context, floating_address)

In the (very) short window between allocation and floating_ip_set_auto_assigned the about to be auto assigned address becomes visible to the user, and if they're quick enough they can de-allocate it just before the allocate_for_instance call goes ahead and sets the auto assigned flag and associates it to the fixed IP of the instance, leaving the DB in an inconsistent state (the address is in use but not allocated to a project).

The fix would be to set the auto_assigned attribute as part of the initial allocation.

Tags: network
melanie witt (melwitt)
tags: added: network
Jiajun Liu (ljjjustin)
Changed in nova:
assignee: nobody → Jiajun Liu (ljjjustin)
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/37842

Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/37842
Committed: http://github.com/openstack/nova/commit/9c328a1128278c9e11c5ccfeac4e7a1f086b49f4
Submitter: Jenkins
Branch: master

commit 9c328a1128278c9e11c5ccfeac4e7a1f086b49f4
Author: Jiajun Liu <email address hidden>
Date: Tue Jul 30 10:39:15 2013 +0800

    handle auto assigned flag on allocate floating ip

    Set auto_assigned field to the right value on allocating floating ip to
    avoid potential race condition in nova-network.

    fix bug 1190585

    Change-Id: I8ee34924439d2a29b1b5a966b92856e63cc1afdc

Jiajun Liu (ljjjustin)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-rc1 → 2013.2
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.