yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #35738
[Bug 1477921] [NEW] Create/Update port responds 500 to the request with invalid "security_groups"
Public bug reported:
When I request "POST /v2.0/ports/" and "PUT /v2.0/ports/{port_id}" with an invalid value(ex.integer) as "security_groups",
Neutron Server responds 500(Internal Server Error).
It should respond 400 error not 500 error.
API Result and Logs are as follows.
[API Result]
"POST /v2.0/ports/"
stack@ubuntu:~$ curl -gi -X POST http://192.168.122.99:9696/v2.0/ports -H "X-Auth-Token:${TOKEN}" -d '{"port":{"security_groups":90,"network_id":"77e2f811-96
a5-48d2-bd85-132e4f44bcb4"}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Openstack-Request-Id: req-b1e6de3d-8cd0-4015-be65-141126e7c807
Date: Fri, 24 Jul 2015 09:06:07 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
"PUT /v2.0/ports/{port_id}"
stack@ubuntu:~$ curl -gi -X PUT http://192.168.122.99:9696/v2.0/ports/f95f74ff-1ede-483b-9386-c51f470500fe -H "X-Auth-Token:${TOKEN}" -d '{"port":{"security_groups":90}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Openstack-Request-Id: req-4815865b-9631-4812-9424-3b73c997e56f
Date: Fri, 24 Jul 2015 08:46:51 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
[Neutron Server Log]
2015-07-24 17:46:41.947 DEBUG neutron.api.v2.base req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08 Request body: {u'port': {u'security_groups': 3}}from (pid=24319) prepare_request_body /opt/stack/neutron/neutron/api/v2/base.py:606
2015-07-24 17:46:41.949 ERROR neutron.api.v2.resource req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08 update failed
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource Traceback (most recent call last):
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource result = method(request=request, **args)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 146, in wrapper
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource ectxt.value = e.inner_exc
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 119, in __exit__
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 136, in wrapper
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource return f(*args, **kwargs)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 525, in update
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource allow_bulk=self._allow_bulk)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 658, in prepare_request_body
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource res_dict[attr] = attr_vals['convert_to'](res_dict[attr])
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/extensions/securitygroup.py", line 177, in convert_to_uuid_list_or_none
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource for sg_id in value_list:
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource TypeError: 'int' object is not iterable
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource
2015-07-24 17:46:41.955 INFO neutron.wsgi req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08192.168.122.99 - - [24/Jul/2015 17:46:41] "PUT /v2.0/ports/f95f74ff-1ede-483b-9386-c51f470500fe HTTP/1.1" 500 359 0.027116
** Affects: neutron
Importance: Undecided
Assignee: Kengo Hobo (hobo-kengo)
Status: New
** Changed in: neutron
Assignee: (unassigned) => Kengo Hobo (hobo-kengo)
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1477921
Title:
Create/Update port responds 500 to the request with invalid
"security_groups"
Status in neutron:
New
Bug description:
When I request "POST /v2.0/ports/" and "PUT /v2.0/ports/{port_id}" with an invalid value(ex.integer) as "security_groups",
Neutron Server responds 500(Internal Server Error).
It should respond 400 error not 500 error.
API Result and Logs are as follows.
[API Result]
"POST /v2.0/ports/"
stack@ubuntu:~$ curl -gi -X POST http://192.168.122.99:9696/v2.0/ports -H "X-Auth-Token:${TOKEN}" -d '{"port":{"security_groups":90,"network_id":"77e2f811-96
a5-48d2-bd85-132e4f44bcb4"}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Openstack-Request-Id: req-b1e6de3d-8cd0-4015-be65-141126e7c807
Date: Fri, 24 Jul 2015 09:06:07 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
"PUT /v2.0/ports/{port_id}"
stack@ubuntu:~$ curl -gi -X PUT http://192.168.122.99:9696/v2.0/ports/f95f74ff-1ede-483b-9386-c51f470500fe -H "X-Auth-Token:${TOKEN}" -d '{"port":{"security_groups":90}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=UTF-8
Content-Length: 150
X-Openstack-Request-Id: req-4815865b-9631-4812-9424-3b73c997e56f
Date: Fri, 24 Jul 2015 08:46:51 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
[Neutron Server Log]
2015-07-24 17:46:41.947 DEBUG neutron.api.v2.base req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08 Request body: {u'port': {u'security_groups': 3}}from (pid=24319) prepare_request_body /opt/stack/neutron/neutron/api/v2/base.py:606
2015-07-24 17:46:41.949 ERROR neutron.api.v2.resource req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08 update failed
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource Traceback (most recent call last):
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 83, in resource
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource result = method(request=request, **args)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 146, in wrapper
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource ectxt.value = e.inner_exc
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 119, in __exit__
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 136, in wrapper
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource return f(*args, **kwargs)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 525, in update
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource allow_bulk=self._allow_bulk)
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 658, in prepare_request_body
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource res_dict[attr] = attr_vals['convert_to'](res_dict[attr])
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource File "/opt/stack/neutron/neutron/extensions/securitygroup.py", line 177, in convert_to_uuid_list_or_none
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource for sg_id in value_list:
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource TypeError: 'int' object is not iterable
2015-07-24 17:46:41.949 TRACE neutron.api.v2.resource
2015-07-24 17:46:41.955 INFO neutron.wsgi req-4f4adaa0-3952-4a0f-a450-7b3594c5a11e demo 0522fc19a56b4d7ca32a9140d3d36a08192.168.122.99 - - [24/Jul/2015 17:46:41] "PUT /v2.0/ports/f95f74ff-1ede-483b-9386-c51f470500fe HTTP/1.1" 500 359 0.027116
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1477921/+subscriptions
Follow ups