Associating non-existant floating ip used to return 500 error code. Now returns 400 instead of 404

Bug #957706 reported by Anthony Young
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Invalid
Low
shilpa batchu

Bug Description

Steps to reproduce:

> (run devstack)
> launch instance
> nova add-floating-ip [server_id] 172.24.4.22 # this address is not in db

Expected:

Error message stating that the address does not exist or some such

Actual:

ERROR: Associate floating ip failed (HTTP 500)

In nova-network:

2012-03-16 22:44:29 INFO nova.api.openstack.wsgi [req-84cf91c5-07ec-4f62-a1c0-391f6cc49d8c b399a42284c4438db639d41fc2530baa c4ab6c17bc4742298838bd9c6fbc41e1] HTTP exception thrown: Associate floating ip failed
2012-03-16 22:44:29 INFO nova.api.openstack.wsgi [req-84cf91c5-07ec-4f62-a1c0-391f6cc49d8c b399a42284c4438db639d41fc2530baa c4ab6c17bc4742298838bd9c6fbc41e1] http://192.168.2.10:8774/v2/c4ab6c17bc4742298838bd9c6fbc41e1/servers/8735ddc6-bbe9-4596-9a4f-c6104d076935/action returned with HTTP 500

A not found exception would be helpful to let the user know that she entered the address incorrectly.

tags: added: essex-rc-potential
Changed in nova:
status: New → Triaged
importance: Undecided → Low
Changed in nova:
assignee: nobody → shilpa batchu (shilpa-batchu)
status: Triaged → In Progress
Thierry Carrez (ttx)
tags: removed: essex-rc-potential
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/6367

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

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

Revision history for this message
Rajalakshmi Ganesan (rajalakshmi-ganesan) wrote : Re: Associating non-existant floating ip yields 500

Also when empty floating IP is passed as a request to associate, The error code returned is 500.
Expected:

Error message stating that the address does not exist or some such and the eroor code returned should be 404 as the floading IP is NotFound.

Actual:

ERROR: Associate floating ip failed (HTTP 500)

LOG:

REQ: curl -i http://10.233.52.27:8774/v2/732001bbd21942f1bec893c67c850066/servers/9cc6e27b-9cc8-4b9d-b116-5470773cc286/action -X POST -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 0c54452d1f38469a9e10dcbe060466df

REQ BODY: {"addFloatingIp": {"address": ""}}

RESP:{'date': 'Thu, 17 May 2012 11:30:29 GMT', 'status': '500', 'content-length': '74', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-d838b6dd-6035-44db-b185-c3f63f838070'} {"computeFault": {"message": "Associate floating ip failed", "code": 500}}

Revision history for this message
Rajalakshmi Ganesan (rajalakshmi-ganesan) wrote :

The same scenario is now returning ERROR CODE 400(Bad Request) instead of 404(Not Found).

The error code is expected to be 404 as in the case of boot a server with non-existant image ID. Refer to the following commands for further clarity:

stack@ubuntu:~/devstack$ nova floating-ip-list
+--------------+-------------+----------+------+
| Ip | Instance Id | Fixed Ip | Pool |
+--------------+-------------+----------+------+
| 172.24.4.225 | None | None | nova |
+--------------+-------------+----------+------+
stack@ubuntu:~/devstack$ nova add-floating-ip 898c3ce0-5e06-4bbc-bb51-e165279aaa86 172.24.4.22
ERROR: Error. Unable to associate floating ip (HTTP 400) (Request-ID: req-66cc5a04-614a-40f8-8b9c-9dc9588422c8)
stack@ubuntu:~/devstack$ nova add-floating-ip 898c3ce0-5e06-4bbc-bb51-e165279aaa86 ''
ERROR: Error. Unable to associate floating ip (HTTP 400) (Request-ID: req-0e9bf557-1a3c-4e8d-8627-faf4211cddb5)

But while booting a server with non-existant image ID:

stack@ubuntu:~/devstack$ nova image-list
+--------------------------------------+---------------------------------+--------+--------+
| ID | Name | Status | Server |
+--------------------------------------+---------------------------------+--------+--------+
| 128c9458-211f-4d48-87d8-4812ab57f197 | cirros-0.3.0-x86_64-uec-kernel | ACTIVE | |
| ccc520d2-bb46-4253-bedd-aa7f2b86ccae | cirros-0.3.0-x86_64-uec-ramdisk | ACTIVE | |
| d506424f-d702-4a9c-b2f4-47d82f490671 | cirros-0.3.0-x86_64-uec | ACTIVE | |
+--------------------------------------+---------------------------------+--------+--------+
stack@ubuntu:~/devstack$

send: u'GET /v2/b84f99644c8b4fd494e21a57f71cc5b7/images/d506424f-d702-4a9c-b2f4-47d82f490672 HTTP/1.1\r\nHost: 10.233.52.237:8774\r\nx-auth-project-id: demo\r\nx-auth-token: ee674ddf6dd1433f94cc848bfb1ec3b5\r\naccept-encoding: gzip, deflate\r\naccept: application/json\r\nuser-agent: python-novaclient\r\n\r\n'
reply: 'HTTP/1.1 404 Not Found\r\n'
header: Content-Length: 62
header: Content-Type: application/json; charset=UTF-8
header: X-Compute-Request-Id: req-a2a29620-15e3-45f3-a949-8b738fbb8acc
header: Date: Fri, 27 Jul 2012 17:34:09 GMT

summary: - Associating non-existant floating ip yields 500
+ Associating non-existant floating ip used to return 500 error code. Now
+ returns 400 instead of 404
Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Latest code

dims@dims-desktop:~/bin$ nova add-floating-ip f0b15425-394d-4ae1-a67d-4177f0752ce2 192.168.1.22
ERROR: floating ip not found (HTTP 404) (Request-ID: req-ec3e07f7-202b-4176-84cc-7ba69671cfcf)

Changed in nova:
status: In Progress → Invalid
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.