Race in instance_create when checking for duplicate hostname

Bug #1436897 reported by Alexey I. Froloff
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Low
Unassigned

Bug Description

There's a race condition in instance_create, that allows creation several instances with duplicate hostname/display_name. Before storing instance record in database, there's a query for existing records with same hostname.

    with session.begin():
        if 'hostname' in values:
            _validate_unique_server_name(context, session, values['hostname'])
        instance_ref.security_groups = _get_sec_group_models(session,
                security_groups)
        session.add(instance_ref)

If another instance with same hostname is stored after _validate_unique_server_name, there will be duplicates.

We hit this bug when badly-written client resubmitted POST request after timeout.

ugvddm (271025598-9)
Changed in nova:
assignee: nobody → ugvddm (271025598-9)
Revision history for this message
jichenjc (jichenjc) wrote :

it should be valid ....

Changed in nova:
status: New → Confirmed
Changed in nova:
importance: Undecided → Low
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/172693

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Zhengguang Ou (<email address hidden>) on branch: master
Review: https://review.openstack.org/172693
Reason: I can't find good solution

Changed in nova:
assignee: ugvddm (271025598-9) → nobody
status: In Progress → Confirmed
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.