yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #59092
[Bug 1640034] Re: Creating/Updating port returns 500 error when specifying list which includes string that contains "ip_address" or "mac_address" as 'allowed_address_pairs'
Reviewed: https://review.openstack.org/396079
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=63d428a60d2c3c27f9f1138f77671516a4d0091d
Submitter: Jenkins
Branch: master
commit 63d428a60d2c3c27f9f1138f77671516a4d0091d
Author: hobo.kengo <hobo.kengo@xxxxxxxxxxxxxx>
Date: Thu Nov 10 10:24:50 2016 +0000
Add check to address_pair that items in list are dict
This patch adds check to allowed_address_pairs that
items in list are dictionary before checking
'ip_address' and 'mac_address'.
From user view, error is changed to 400 from 500 when
creating/updating port with 'allowed_address_pairs'
specifying string that contains "ip_address" or "mac_address".
Change-Id: I92ea4d56e01b0e122c2150f9d82464b67f4dc466
Closes-Bug: #1640034
** Changed in: neutron
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1640034
Title:
Creating/Updating port returns 500 error when specifying list which
includes string that contains "ip_address" or "mac_address" as
'allowed_address_pairs'
Status in neutron:
Fix Released
Bug description:
The error should be returned with 400 because invalid request format
is reason.
* How to reproduce
-ip_address
ubuntu@neutron-ml2:/opt/stack/neutron$ curl -si -X PUT -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" http://172.16.1.29:9696/v2.0/ports/517eeaa9-238a-4c95-96d3-c6ed6b289ffb -d '{"port":{"allowed_address_pairs":["ip_address"]}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 150
X-Openstack-Request-Id: req-b68113ea-6323-4087-b789-b9f8a9a7f260
Date: Tue, 08 Nov 2016 06:33:19 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
-mac_address
ubuntu@neutron-ml2:/opt/stack/neutron$ curl -si -X PUT -H "X-Auth-Token: $TOKEN" -H "Content-type: application/json" http://172.16.1.29:9696/v2.0/ports/517eeaa9-238a-4c95-96d3-c6ed6b289ffb -d '{"port":{"allowed_address_pairs":["mac_address"]}}'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Content-Length: 150
X-Openstack-Request-Id: req-1e62dafa-dc0b-4986-a0cf-7a1ec84c2eee
Date: Tue, 08 Nov 2016 06:32:18 GMT
{"NeutronError": {"message": "Request Failed: internal server error
while processing your request.", "type": "HTTPInternalServerError",
"detail": ""}}
* trace in neutron-server
-ip_address
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource [req-b68113ea-6323-4087-b789-b9f8a9a7f260 6759f544889746448631792bb12bd2ea d713c7d4c02541d8b239d6d9761768e5 - - -] upd
ate failed: No details.
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource Traceback (most recent call last):
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource result = method(request=request, **args)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 604, in update
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource return self._update(request, id, body, **kwargs)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 83, in wrapped
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource setattr(e, '_RETRY_EXCEEDED', True)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource self.force_reraise()
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 79, in wrapped
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource ectxt.value = e.inner_exc
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource self.force_reraise()
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 119, in wrapped
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource traceback.format_exc())
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource self.force_reraise()
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 114, in wrapped
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource return f(*dup_args, **dup_kwargs)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 611, in _update
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource allow_bulk=self._allow_bulk)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 719, in prepare_request_body
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource attributes.convert_value(attr_info, res_dict, webob.exc.HTTPBadRequest)
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/attributes.py", line 431, in convert_value
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource res = validator(res_dict[attr], attr_vals['validate'][rule])
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/extensions/allowedaddresspairs.py", line 67, in _validate_allowed_address_pairs
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource mac = address_pair.get('mac_address')
2016-11-08 06:33:19.441 7216 ERROR neutron.api.v2.resource AttributeError: 'unicode' object has no attribute 'get'
-mac_address
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource [req-1e62dafa-dc0b-4986-a0cf-7a1ec84c2eee 6759f544889746448631792bb12bd2ea d713c7d4c02541d8b239d6d9761768e5 - - -] upd
ate failed: No details.
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource Traceback (most recent call last):
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource result = method(request=request, **args)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 604, in update
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource return self._update(request, id, body, **kwargs)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 83, in wrapped
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource setattr(e, '_RETRY_EXCEEDED', True)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource self.force_reraise()
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 79, in wrapped
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource ectxt.value = e.inner_exc
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource self.force_reraise()
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource return f(*args, **kwargs)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 119, in wrapped
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource traceback.format_exc())
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource self.force_reraise()
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource six.reraise(self.type_, self.value, self.tb)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/db/api.py", line 114, in wrapped
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource return f(*dup_args, **dup_kwargs)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 611, in _update
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource allow_bulk=self._allow_bulk)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/base.py", line 719, in prepare_request_body
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource attributes.convert_value(attr_info, res_dict, webob.exc.HTTPBadRequest)
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/api/v2/attributes.py", line 431, in convert_value
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource res = validator(res_dict[attr], attr_vals['validate'][rule])
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource File "/opt/stack/neutron/neutron/extensions/allowedaddresspairs.py", line 61, in _validate_allowed_address_pairs
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource msg = validators.validate_mac_address(address_pair['mac_address'])
2016-11-08 06:32:18.672 7216 ERROR neutron.api.v2.resource TypeError: string indices must be integers
To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1640034/+subscriptions
References