Nova's fault wrap hiding real error status code from Neutron (and maybe others)

Bug #1343458 reported by Justin Hammond
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Unassigned

Bug Description

As a user I expect something that would produce a 404 to return a 404. Such as:

$ nova net-delete some_garbage

REQ: curl -i 'http://127.0.0.1:8774/v2/4eb9fda29831446cbfd22ab82a901284/os-tenant-networks/asdfasdfasdf' -X DELETE -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: demo" -H "X-Auth-Token: {SHA1}c7b9ac5b9d6c88abd70694db6cbb175c223f988a"
RESP: [500] CaseInsensitiveDict({'date': 'Thu, 17 Jul 2014 18:00:59 GMT', 'content-length': '128', 'content-type': 'application/json; charset=UTF-8', 'x-compute-request-id': 'req-9f02f305-c01d-462c-abd4-0f9a283d992f'})
RESP BODY: {"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}

DEBUG (shell:802) The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-9f02f305-c01d-462c-abd4-0f9a283d992f)
Traceback (most recent call last):
  File "/opt/stack/python-novaclient/novaclient/shell.py", line 799, in main
    OpenStackComputeShell().main(argv)
  File "/opt/stack/python-novaclient/novaclient/shell.py", line 729, in main
    args.func(self.cs, args)
  File "/opt/stack/python-novaclient/novaclient/v1_1/contrib/tenant_networks.py", line 78, in do_net_delete
    cs.tenant_networks.delete(args.network_id)
  File "/opt/stack/python-novaclient/novaclient/v1_1/contrib/tenant_networks.py", line 36, in delete
    self._delete('/os-tenant-networks/%s' % base.getid(network))
  File "/opt/stack/python-novaclient/novaclient/base.py", line 109, in _delete
    _resp, _body = self.api.client.delete(url)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 491, in delete
    return self._cs_request(url, 'DELETE', **kwargs)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 459, in _cs_request
    **kwargs)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 441, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 435, in request
    raise exceptions.from_response(resp, body, url, method)
InternalServerError: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-9f02f305-c01d-462c-abd4-0f9a283d992f)
ERROR (InternalServerError): The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-9f02f305-c01d-462c-abd4-0f9a283d992f)

When it is not implemented that makes sense. On my cloud installation I also receive this from neutron:

2014-07-14 16:39:08.200 29740 INFO neutron.wsgi [-] 10.23.245.95,10.13.143.233 - - [14/Jul/2014 16:39:08] "DELETE /v2.0/networks/jlh_delete_me.json HTTP/1.1"
404 176 0.010104

I believe nova.api.openstack.FaultWrapper is messing up the return from Neutron and showing the user a 500 (the default response to exceptions) instead of the expected 404.

affects: cinder → nova
Tracy Jones (tjones-i)
tags: added: api
tags: added: network
Brent Eagles (beagles)
tags: added: neutron
Revision history for this message
Thang Pham (thang-pham) wrote :

I tried this on my devstack environment, with neutron as my networking service, and got:

$ nova net-delete <uuid>
ERROR (ClientException): The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-a7c2f648-9d1e-41cb-b55f-bb9fdea303a0)

Trace:
2014-08-12 10:43:27.597 21183 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/contrib/os_tenant_networks.py", line 135, in delete
2014-08-12 10:43:27.597 21183 TRACE nova.api.openstack self.network_api.delete(context, id)
2014-08-12 10:43:27.597 21183 TRACE nova.api.openstack File "/opt/stack/nova/nova/network/neutronv2/api.py", line 872, in delete
2014-08-12 10:43:27.597 21183 TRACE nova.api.openstack raise NotImplementedError()
2014-08-12 10:43:27.597 21183 TRACE nova.api.openstack NotImplementedError

The error (HTTP500) appears correct. Looking at the code, nova/network/neutronv2/api.py, delete() is raising a NotImplementedError exception. I am not sure why that part of the code is left unimplemented, but using the neutron CLI works fine.

Revision history for this message
Sean Dague (sdague) wrote :

While I'm not sure when it changed:

nova net-delete some_garbage now seems to do the right thing on Juno.

os1:~> nova net-delete some_garbage
ERROR (NotFound): Network not found (HTTP 404) (Request-ID: req-5b97d675-7d9c-48c7-9462-d6c06e28ab61)

Changed in nova:
status: New → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-rc1 → 2014.2
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.