request neutron with Incorrect body key return 500

Bug #1838587 reported by ZhouHeng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
ZhouHeng

Bug Description

In current neutron, when I update resource with incorrect body, neutron server return 500 NeutronError. It should be fixed 400(BadRequest)

example:
PUT /v2.0/networks/<network_id>
body:
{
    "subnet": {
        ...
     }
}
neutron server return
{"NeutronError": {"message": "Request Failed: internal server error while processing your request.", "type": "HTTPInternalServerError", "detail": ""}}

Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/pecan/core.py", line 683, in __call__
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation self.invoke_controller(controller, args, kwargs, state)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/pecan/core.py", line 574, in invoke_controller
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation result = controller(*args, **kwargs)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 139, in wrapped
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation setattr(e, '_RETRY_EXCEEDED', True)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 135, in wrapped
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 154, in wrapper
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation ectxt.value = e.inner_exc
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 142, in wrapper
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 183, in wrapped
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation LOG.debug("Retry wrapper got retriable exception: %s", e)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/usr/lib/python2.7/site-packages/neutron_lib/db/api.py", line 179, in wrapped
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation return f(*dup_args, **dup_kwargs)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/pecan_wsgi/controllers/utils.py", line 76, in wrapped
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/pecan_wsgi/controllers/resource.py", line 62, in put
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation resources = request.context['resources']
Jul 31 20:56:08 nfs neutron-server[11250]: ERROR neutron.pecan_wsgi.hooks.translation KeyError: 'resources'

Tags: api
ZhouHeng (zhouhenglc)
Changed in neutron:
assignee: nobody → ZhouHeng (zhouhenglc)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/674153

Changed in neutron:
status: New → In Progress
tags: added: api
removed: api-ref
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/674153
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=45612ca52f0a318d437904b1599095e971a831b9
Submitter: Zuul
Branch: master

commit 45612ca52f0a318d437904b1599095e971a831b9
Author: zhouhenglc <email address hidden>
Date: Fri Aug 2 10:29:38 2019 +0800

    fix update neutron resource with incorrect body key server return 500

    In current neutron, when I update resource with incorrect body, neutron
    server return 500 NeutronError. It should be fixed and BadRequest (400)
    should be returned.
    This patch fixed it.

    Change-Id: I024b8ef73be69af069e4516dc501df3f5c145419
    Partial-bug: #1838587

Changed in neutron:
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.