← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1633066] Re: Input int value into service_type list hit internal error

 

Reviewed:  https://review.openstack.org/386086
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=a594df67a73a73dc6d26b62b29aa93dfb5f8d00c
Submitter: Jenkins
Branch:    master

commit a594df67a73a73dc6d26b62b29aa93dfb5f8d00c
Author: ZhaoBo <zhaobo6@xxxxxxxxxx>
Date:   Fri Oct 14 00:52:27 2016 +0800

    Catch invalid subnet service_types on input
    
    _validate_subnet_service_types function does not consider the
    data type of service_type on creatation or update. For example,
    if an integer type is passed, the neutron-server will hit
    internal error.
    
    This patch adds a check to make sure the data type is unicode.
    
    Change-Id: I5e6d15def3e23f51172b69e1287ff18ab5d3f6aa
    Closes-Bug: #1633066


** 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/1633066

Title:
  Input int value into service_type list hit internal error

Status in neutron:
  Fix Released

Bug description:
  I use REST api to create/update subnet with serive_types. I use some
  int type values in the list.

  The creation body is:
  {
  	"subnet": {
  		"network_id": "0d04102a-ba15-4d6c-94ee-8ac480cbb1ba",
  		"name": "hellowor",
  		"cidr": "99.99.99.99/24",
  		"service_types" : ["network:1",2,3],
  		"ip_version": 4
  	}
  }

  neutron server hit internal error.
  2016-10-13 17:44:27.842 ERROR neutron.api.v2.resource [req-b9846c07-3574-4094-b6fe-ca978c1d31ce admin 488da3aab0ff45df9e85e17e7f89fedd] create failed: No details.
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource Traceback (most recent call last):
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 79, in resource
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     result = method(request=request, **args)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 430, in create
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     return self._create(request, body, **kwargs)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 88, in wrapped
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     setattr(e, '_RETRY_EXCEEDED', True)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     self.force_reraise()
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 84, in wrapped
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     return f(*args, **kwargs)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 151, in wrapper
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     ectxt.value = e.inner_exc
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     self.force_reraise()
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 139, in wrapper
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     return f(*args, **kwargs)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 124, in wrapped
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     traceback.format_exc())
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     self.force_reraise()
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/db/api.py", line 119, in wrapped
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     return f(*dup_args, **dup_kwargs)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 439, in _create
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     allow_bulk=self._allow_bulk)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/base.py", line 719, in prepare_request_body
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     attributes.convert_value(attr_info, res_dict, webob.exc.HTTPBadRequest)
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/api/v2/attributes.py", line 431, in convert_value
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     res = validator(res_dict[attr], attr_vals['validate'][rule])
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource   File "/opt/stack/neutron/neutron/extensions/subnet_service_types.py", line 47, in _validate_subnet_service_types
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource     not service_type.startswith(tuple(prefixes))):
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource AttributeError: 'int' object has no attribute 'startswith'
  2016-10-13 17:44:27.842 TRACE neutron.api.v2.resource

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1633066/+subscriptions


References