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

Bug #1370359 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 network id, Nova returns an HTTP 500 which informs me that the attach interface operation fails.

REQ: curl -i 'http://10.90.10.24:8774/v2/19abae5746b242d489d1c2862b228d8b/servers/4e863fad-e868-48a1-8735-2da9a38561e8/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}e8bf3f6e4599a94e4ce1625abc3bc8a2dfd2742c" -d '{"interfaceAttachment": {"fixed_ips": [{"ip_address": "10.100.99.170"}], "net_id": "173854d5-333f-4c78-b5a5-10d2e9c8d82z"}}'
INFO (connectionpool:187) Starting new HTTP connection (1): 10.90.10.24
DEBUG (connectionpool:357) "POST /v2/19abae5746b242d489d1c2862b228d8b/servers/4e863fad-e868-48a1-8735-2da9a38561e8/os-interface HTTP/1.1" 500 72
RESP: [500] {'date': 'Wed, 17 Sep 2014 06:13:02 GMT', 'content-length': '72', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-93700c2a-fab2-42b9-9427-7136ac3f0f59'}
RESP BODY: {"computeFault": {"message": "Failed to attach interface", "code": 500}}

In fact, Nova get an empty network list from Neutron due to my incorrect input. Nova should be able to address the error and return an HTTP 400 error in order to to inform the user to correct the network id in 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/122091

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.