API Create - duplicate names returns a 500 Error

Bug #1376936 reported by Alun Champion
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Christopher Yeoh

Bug Description

When setting osapi_compute_unique_server_name_scope to project or global, duplicate names in the appropriate scope should return a BadRequest (400) but currently returns a ClientException (500), with an unhelpful message.

In nova.api.openstack.compute.Controller.create InstanceExists exception is not caught and mapped to BadRequest.

Tags: api
Changed in nova:
status: New → Confirmed
assignee: nobody → Christopher Yeoh (cyeoh-0)
Revision history for this message
Christopher Yeoh (cyeoh-0) wrote :

I think 409 conflict is more appropriate that 400 bad request

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/125863

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Alun Champion (prof-f) wrote :

Does this constituent a change in the API spec, I don't believe 409 is listed as one of the error response codes?

Revision history for this message
Christopher Yeoh (cyeoh-0) wrote :

Its a change, but not a backwards incompatible change. Our API Change guidelines allow for the
changing error codes (not success ones) if the new one is more appropriate.

https://wiki.openstack.org/wiki/APIChangeGuidelines

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/125863
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=8cedf63e5ccc9a023884b77fc460f8372300012d
Submitter: Jenkins
Branch: master

commit 8cedf63e5ccc9a023884b77fc460f8372300012d
Author: Chris Yeoh <email address hidden>
Date: Fri Oct 3 12:15:23 2014 +0930

    Correctly catch InstanceExists in servers create API

    When osapi_compute_unique_server_name_scope is set to project
    or global an attempt to create a server with a name which
    already exists results in an InstanceExists exception being raised.
    This was not being handled in the API layer causing a 500
    status error code. This patch fixes it so the exception is caught
    correctly and a 409 Conflict is returned instead

    Change-Id: Ifee3476622b227991a4c2a2780ae7ff23787ccb9
    Closes-Bug:1376936

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/128583

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/130189

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/130456

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/icehouse)

Change abandoned by Artem Yasakov (<email address hidden>) on branch: stable/icehouse
Review: https://review.openstack.org/128583
Reason: repeated changes https://review.openstack.org/#/c/130189/

Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-1 → 2015.1.0
Matt Riedemann (mriedem)
tags: added: api
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Matt Riedemann (<email address hidden>) on branch: stable/icehouse
Review: https://review.openstack.org/130189
Reason: At this point we're looking to end of life stable/icehouse and given this isn't a critical bug fix I don't think it's worth backporting to icehouse.

Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/juno)

Change abandoned by Matt Riedemann (<email address hidden>) on branch: stable/juno
Review: https://review.openstack.org/130456
Reason: stable/juno is in support phase 2 which is security/critical fixes only, so given this is a low severity fix and has some concern about API changes (although OK on master), we are going to abandon this.

https://wiki.openstack.org/wiki/StableBranch#Support_phases

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.