OS API: network fails for not existing networks
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/
2012-07-16 18:42:09 TRACE nova.api.openstack return req.get_
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 18:42:09 TRACE nova.api.openstack application, catch_exc_
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 18:42:09 TRACE nova.api.openstack app_iter = application(
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
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/
2012-07-16 18:42:09 TRACE nova.api.openstack self.network_
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/
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/
2012-07-16 18:42:09 TRACE nova.api.openstack return _get_impl(
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/
2012-07-16 18:42:09 TRACE nova.api.openstack return rpc_amqp.
2012-07-16 18:42:09 TRACE nova.api.openstack File "/usr/lib/
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/
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: NetworkNotFound
This handler does not catches anything:
try:
except exception.
raise exc.HTTPNotFoun
network.api calls raise RemoteError and never NetworkNotFound.
A handler like this can be more suitable:
try:
except Exception as ex:
raise exc.HTTPBadRequest(
Fix proposed to branch: master /review. openstack. org/10124
Review: https:/