ExternalGatewayForFloatingIPNotFound returns missleading http status code

Bug #2006122 reported by Felix Huettner
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
In Progress
Low
Felix Huettner

Bug Description

When trying to associate a floating ip with a vm that does not have access to the floating ip network (e.g. there is no router connected) a ExternalGatewayForFloatingIPNotFound exception is raised.
This exception is translated to the client as a http status code "Not Found" (404).

From my perspective this is misleading as the floating ip the call is about has clearly been found.
Rather the request send from the client is invalid as the client needs to issue some other api calls first (or fixing the issue is outside the clients control).

Proposed alternatives (quoted from rfc9110):

* "Bad Request" (400): "[...] indicates that the server cannot or will not process the request due to something that is perceived to be a client error [...]"
* "Unprocessable Entity" (422): "[...] the server understands the content type of the request content, and the syntax of the request content is correct, but it was unable to process the contained instructions. [...]"

While 422 might be more specific we use 400 already in a lot of cases, so i will open a fix for that.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron-lib (master)
Changed in neutron:
status: New → In Progress
Revision history for this message
Felix Huettner (felix.huettner) wrote :

Also from the documentation of floating ip create

```
The operation returns the Bad Request (400) response code for one of reasons:
* The network is not external, such as router:external=False.
* The internal OpenStack Networking port is not associated with the floating IP address.
* The requested floating IP address does not fall in the subnet range for the external network.
* The fixed IP address is not valid.

If the port ID is not valid, this operation returns 404 response code.

The operation returns the Conflict (409) response code for one of reasons:
* The requested floating IP address is already in use.
* The internal OpenStack Networking port and fixed IP address are already associated with another floating IP.
* The external DNS service recordset quota exceeds the limit.
```

for me this would also point use 400 for the response code

Revision history for this message
Felix Huettner (felix.huettner) wrote :

While implementing the change i noticed that it would need a change on the tempest side as well. This would cause a `depends-on` circle. Could you tell me how to best solve that (or if the api interface must be kept stable for this case)

Changed in neutron:
importance: Undecided → Low
assignee: nobody → Felix Huettner (felix.huettner)
Revision history for this message
Lajos Katona (lajos-katona) wrote :

Worst case you can ask QA team to accept temporary skipping of a given testcase and whn the fix is there you can adopt the test to it and make it executed again

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron-lib (master)

Change abandoned by "Slawek Kaplonski <email address hidden>" on branch: master
Review: https://review.opendev.org/c/openstack/neutron-lib/+/872748
Reason: This review is > 4 weeks without comment, and failed Zuul jobs the last time it was checked. We are abandoning this for now. Feel free to reactivate the review by pressing the restore button and leaving a 'recheck' comment to get fresh test results.

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.