HTTP 500 is returned when using an invalid port id to attach interface

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

Bug Description

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

REQ: curl -i 'http://10.104.0.214:8774/v2/b6a08719633d416da2d12265debac838/servers/fd21141e-4fb6-4e2a-9638-f37efe854003/os-interface' -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: admin" -H "X-Auth-Token: {SHA1}af2fe67d675d5d1c6fb5f55278cbcd98dd83afc5" -d '{"interfaceAttachment": {"port_id": "c510a9f3-5f45-4e96-8545-54acbbecb2c1"}}'
INFO (connectionpool:203) Starting new HTTP connection (1): 10.104.0.214
DEBUG (connectionpool:295) "POST /v2/b6a08719633d416da2d12265debac838/servers/fd21141e-4fb6-4e2a-9638-f37efe854003/os-interface HTTP/1.1" 500 128
RESP: [500] {'date': 'Fri, 17 Oct 2014 05:09:38 GMT', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8'}
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.

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

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

commit e57412c05e2ee52d40d294a1636c9fc2b990b636
Author: Qin Zhao <email address hidden>
Date: Wed Sep 17 16:36:35 2014 +0800

    Raise NotFound if attach interface with invalid net id or port id

    When posting an 'attach interface' request to Nova with an invalid
    network id or port id, Nova returns HTTP 500 which indicates the
    attach operation fails. In fact, Nova get an empty network list or
    PortNotFound exception from Neutron due to incorrect input. Nova
    should address the error and raise NotFound in order to inform the
    user to correct the request.

    Change-Id: I3c5e07d5d6920a750d25398da8388a39b76a2944
    Closes-Bug: 1370359
    Closes-Bug: 1382343

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-2 → 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.