HTTP 500 is returned when using an invalid fixed ip to attach interface

Bug #1365579 reported by Qin Zhao
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Qin Zhao

Bug Description

When I post an 'attach interface' request to Nova with an invalid fixed ip, Nova returns an HTTP 500 error and a confusing error message.

REQ: curl -i 'http://10.90.10.24:8774/v2/19abae5746b242d489d1c2862b228d8b/servers/1b1618fa-ddbd-4fce-aa04-720a72ec7dfe/os-interface' -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: Public" -H "X-Auth-Token: {SHA1}7b9d24c40fa509ff9ae6950a201cb7f12b7da165" -d '{"interfaceAttachment": {"fixed_ips": [{"ip_address": "abcd"}], "net_id": "173854d5-333f-4c78-b5a5-10d2e9c8d827"}}'
INFO (connectionpool:187) Starting new HTTP connection (1): 10.90.10.24
DEBUG (connectionpool:357) "POST /v2/19abae5746b242d489d1c2862b228d8b/servers/1b1618fa-ddbd-4fce-aa04-720a72ec7dfe/os-interface HTTP/1.1" 500 128
RESP: [500] {'date': 'Thu, 04 Sep 2014 16:06:49 GMT', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-7053d4e0-59df-46ca-9f55-63a2f1f2d412'}
RESP BODY: {"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}

In fact, Nova works perfect well. The error is caused by my incorrect input. Nova should be able to address this incorrect input, and return an HTTP 400 error in order to to inform the user to correct the 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/119128

Changed in nova:
assignee: nobody → Qin Zhao (zhaoqin)
status: New → In Progress
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c1be465b07e7a107e68142acaa4396e6e7792146
Author: Qin Zhao <email address hidden>
Date: Fri Sep 5 00:46:30 2014 +0800

    Return HTTP 400 if use invalid fixed ip to attach interface

    When posting an 'attach interface' request to Nova with an invalid fixed ip,
    Nova need to return HTTP 400, instead of HTTP 500, in order to inform the
    user to correct the fixed ip in HTTP request. It is an API v2 only problem.

    Change-Id: I34fc813f38b463460c59672e6c3364aea9ef347d
    Closes-Bug: 1365579

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