NeutronClientException exception isn't handled when showing a network

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

Bug Description

When I ran 'nova net xxx' to show a network's details, I got a 500 error if the network_uuid does not exist.
This is because the NeutronClientException exception is not caught by nova api.

$ nova net xxx

ERROR: The server has either erred or is incapable of performing the requested operation. (HTTP 500) (Request-ID: req-e744c9ae-b8ad-4c39-a77c-44e8bb05577c)

2014-03-01 02:37:25.764 ERROR nova.api.openstack [req-35d8246e-d414-4b62-b759-ab2c4bf86082 demo demo] Caught error:
404 Not Found

The resource could not be found.

2014-03-01 02:37:25.764 TRACE nova.api.openstack Traceback (most recent call last):
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 125,
in __call__
2014-03-01 02:37:25.764 TRACE nova.api.openstack return req.get_response(self.application)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", l
ine 1296, in send
2014-03-01 02:37:25.764 TRACE nova.api.openstack application, catch_exc_info=False)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", l
ine 1260, in call_application
2014-03-01 02:37:25.764 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
144, in __call__
2014-03-01 02:37:25.764 TRACE nova.api.openstack return resp(environ, start_response)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-keystoneclient/keystoneclient/middleware/
auth_token.py", line 598, in __call__
2014-03-01 02:37:25.764 TRACE nova.api.openstack return self.app(env, start_response)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
144, in __call__
2014-03-01 02:37:25.764 TRACE nova.api.openstack return resp(environ, start_response)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
144, in __call__
2014-03-01 02:37:25.764 TRACE nova.api.openstack return resp(environ, start_response)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line
130, in __call__
2014-03-01 02:37:25.764 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2014-03-01 02:37:25.764 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 929, in __call__
2014-03-01 02:37:25.764 TRACE nova.api.openstack content_type, body, accept)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 991, in _process_stack
2014-03-01 02:37:25.764 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 1078, in dispatch
2014-03-01 02:37:25.764 TRACE nova.api.openstack return method(req=request, **action_args)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/contrib/os_tenant_networks.py", line 108, in show
2014-03-01 02:37:25.764 TRACE nova.api.openstack network = self.network_api.get(context, id)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/nova/nova/network/neutronv2/api.py", line 689, in get
2014-03-01 02:37:25.764 TRACE nova.api.openstack try:
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-neutronclient/neutronclient/v2_0/client.py", line 112, in with_params
2014-03-01 02:37:25.764 TRACE nova.api.openstack ret = self.function(instance, *args, **kwargs)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-neutronclient/neutronclient/v2_0/client.py", line 339, in show_network
2014-03-01 02:37:25.764 TRACE nova.api.openstack return self.get(self.network_path % (network), params=_params)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-neutronclient/neutronclient/v2_0/client.py", line 1237, in get
2014-03-01 02:37:25.764 TRACE nova.api.openstack print ("body: ", body)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-neutronclient/neutronclient/v2_0/client.py", line 1222, in retry_request
2014-03-01 02:37:25.764 TRACE nova.api.openstack headers=headers, params=params)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-neutronclient/neutronclient/v2_0/client.py", line 1165, in do_request
2014-03-01 02:37:25.764 TRACE nova.api.openstack self._handle_fault_response(status_code, replybody)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-neutronclient/neutronclient/v2_0/client.py", line 1135, in _handle_fault_response
2014-03-01 02:37:25.764 TRACE nova.api.openstack exception_handler_v20(status_code, des_error_body)
2014-03-01 02:37:25.764 TRACE nova.api.openstack File "/opt/stack/python-neutronclient/neutronclient/v2_0/client.py", line 92, in exception_handler_v20
2014-03-01 02:37:25.764 TRACE nova.api.openstack message=message)
2014-03-01 02:37:25.764 TRACE nova.api.openstack NeutronClientException: 404 Not Found
2014-03-01 02:37:25.764 TRACE nova.api.openstack
2014-03-01 02:37:25.764 TRACE nova.api.openstack The resource could not be found.

Haiwei Xu (xu-haiwei)
Changed in nova:
assignee: nobody → Haiwei Xu (xu-haiwei)
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/77477

Changed in nova:
status: New → In Progress
Matt Riedemann (mriedem)
tags: added: network neutron
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/77477
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=dac0ce979ed7871539c8bcf19fcc73a2ab1390a3
Submitter: Jenkins
Branch: master

commit dac0ce979ed7871539c8bcf19fcc73a2ab1390a3
Author: Haiwei Xu <email address hidden>
Date: Tue Feb 25 02:36:51 2014 +0900

    Catch NeutronClientException when showing a network

    When a network id can't be found, neutronclient raise
    NetworkNotFoundClient exception, but this exception is not
    handled by nova. This will cause a 500 error.
    This patch fixes this bug.

    Closes-Bug: #1286969
    Change-Id: Ia96c9668c74374476d4dccdbdb281e99d91b0088

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