OS API: network fails for not existing networks

Bug #1025329 reported by Alexej Ababilov
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Alexej Ababilov
Essex
New
Undecided
Unassigned

Bug Description

OS API network calls do not handle remote errors properly. For example, if you try to get, delete, or disassociate a network that does not exist, you will see

{"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}

nova-api.log:

2012-07-16 18:42:09 TRACE nova.api.openstack Traceback (most recent call last):
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/api/openstack/__init__.py", line 41, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack return req.get_response(self.application)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/request.py", line 1053, in get_response
2012-07-16 18:42:09 TRACE nova.api.openstack application, catch_exc_info=False)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/request.py", line 1022, in call_application
2012-07-16 18:42:09 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/keystone/middleware/auth_token.py", line 176, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack return self.app(env, start_response)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/dec.py", line 159, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack return resp(environ, start_response)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/dec.py", line 159, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack return resp(environ, start_response)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/dec.py", line 159, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack return resp(environ, start_response)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/routes/middleware.py", line 131, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack response = self.app(environ, start_response)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/dec.py", line 159, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack return resp(environ, start_response)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/dec.py", line 147, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/webob/dec.py", line 208, in call_func
2012-07-16 18:42:09 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 803, in __call__
2012-07-16 18:42:09 TRACE nova.api.openstack content_type, body, accept)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 851, in _process_stack
2012-07-16 18:42:09 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/api/openstack/wsgi.py", line 926, in dispatch
2012-07-16 18:42:09 TRACE nova.api.openstack return method(req=request, **action_args)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova_networks/networks.py", line 116, in delete
2012-07-16 18:42:09 TRACE nova.api.openstack self.network_api.delete(context, id)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/network/api.py", line 58, in delete
2012-07-16 18:42:09 TRACE nova.api.openstack 'uuid': network_uuid}})
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/rpc/__init__.py", line 68, in call
2012-07-16 18:42:09 TRACE nova.api.openstack return _get_impl().call(context, topic, msg, timeout)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/rpc/impl_kombu.py", line 674, in call
2012-07-16 18:42:09 TRACE nova.api.openstack return rpc_amqp.call(context, topic, msg, timeout, Connection.pool)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/rpc/amqp.py", line 343, in call
2012-07-16 18:42:09 TRACE nova.api.openstack rv = list(rv)
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/python2.6/site-packages/nova/rpc/amqp.py", line 311, in __iter__
2012-07-16 18:42:09 TRACE nova.api.openstack raise result
2012-07-16 18:42:09 TRACE nova.api.openstack RemoteError: Remote error: NetworkNotFoundForUUID Network could not be found for uuid qwqwq

This handler does not catches anything:

        try:
            self.network_api.delete(context, id)
        except exception.NetworkNotFound:
            raise exc.HTTPNotFound(_("Network not found"))

network.api calls raise RemoteError and never NetworkNotFound.

A handler like this can be more suitable:
        try:
            self.network_api.delete(context, id)
        except Exception as ex:
            raise exc.HTTPBadRequest(
                explanation=_("Cannot delete network. %s") %
                getattr(ex, "value", str(ex)))

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/10124

Changed in nova:
assignee: nobody → Alessio Ababilov (aababilov)
status: New → In Progress
Revision history for this message
Mark McLoughlin (markmc) wrote :

Pretty sure this is fixed in Folsom by: https://review.openstack.org/#/c/5749/

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