create of segment range for vlan network type fails with error 500

Bug #1823297 reported by Slawek Kaplonski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Low
Slawek Kaplonski

Bug Description

When new network segment range is created for vlan network type and physical_network is not specified it fails with error 500.

Traceback in neutron-server logs:

ERROR oslo_db.sqlalchemy.exc_filters [None req-4e6378b0-1bd1-4166-b9f0-88be75d3e029 admin admin] DB exception wrapped.: AttributeError: 'Sentinel' object has no attribute 'translate'
ERROR oslo_db.sqlalchemy.exc_filters Traceback (most recent call last):
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
ERROR oslo_db.sqlalchemy.exc_filters cursor, statement, parameters, context
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
ERROR oslo_db.sqlalchemy.exc_filters cursor.execute(statement, parameters)
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 168, in execute
ERROR oslo_db.sqlalchemy.exc_filters query = self.mogrify(query, args)
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 147, in mogrify
ERROR oslo_db.sqlalchemy.exc_filters query = query % self._escape_args(args, conn)
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 127, in _escape_args
ERROR oslo_db.sqlalchemy.exc_filters return {key: conn.literal(val) for (key, val) in args.items()}
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 127, in <dictcomp>
ERROR oslo_db.sqlalchemy.exc_filters return {key: conn.literal(val) for (key, val) in args.items()}
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 467, in literal
ERROR oslo_db.sqlalchemy.exc_filters return self.escape(obj, self.encoders)
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 460, in escape
ERROR oslo_db.sqlalchemy.exc_filters return converters.escape_item(obj, self.charset, mapping=mapping)
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 27, in escape_item
ERROR oslo_db.sqlalchemy.exc_filters val = encoder(val, mapping)
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 118, in escape_unicode
ERROR oslo_db.sqlalchemy.exc_filters return u"'%s'" % _escape_unicode(value)
ERROR oslo_db.sqlalchemy.exc_filters File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 73, in _escape_unicode
ERROR oslo_db.sqlalchemy.exc_filters return value.translate(_escape_table)
ERROR oslo_db.sqlalchemy.exc_filters AttributeError: 'Sentinel' object has no attribute 'translate'
ERROR oslo_db.sqlalchemy.exc_filters
ERROR neutron.pecan_wsgi.hooks.translation [None req-4e6378b0-1bd1-4166-b9f0-88be75d3e029 admin admin] POST failed.: oslo_db.exception.DBError: 'Sentinel' object has no attribute 'translate'
ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
ERROR neutron.pecan_wsgi.hooks.translation cursor, statement, parameters, context
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
ERROR neutron.pecan_wsgi.hooks.translation cursor.execute(statement, parameters)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 168, in execute
ERROR neutron.pecan_wsgi.hooks.translation query = self.mogrify(query, args)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 147, in mogrify
ERROR neutron.pecan_wsgi.hooks.translation query = query % self._escape_args(args, conn)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 127, in _escape_args
ERROR neutron.pecan_wsgi.hooks.translation return {key: conn.literal(val) for (key, val) in args.items()}
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 127, in <dictcomp>
ERROR neutron.pecan_wsgi.hooks.translation return {key: conn.literal(val) for (key, val) in args.items()}
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 467, in literal
ERROR neutron.pecan_wsgi.hooks.translation return self.escape(obj, self.encoders)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 460, in escape
ERROR neutron.pecan_wsgi.hooks.translation return converters.escape_item(obj, self.charset, mapping=mapping)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 27, in escape_item
ERROR neutron.pecan_wsgi.hooks.translation val = encoder(val, mapping)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 118, in escape_unicode
ERROR neutron.pecan_wsgi.hooks.translation return u"'%s'" % _escape_unicode(value)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 73, in _escape_unicode
ERROR neutron.pecan_wsgi.hooks.translation return value.translate(_escape_table)
ERROR neutron.pecan_wsgi.hooks.translation AttributeError: 'Sentinel' object has no attribute 'translate'
ERROR neutron.pecan_wsgi.hooks.translation
ERROR neutron.pecan_wsgi.hooks.translation The above exception was the direct cause of the following exception:
ERROR neutron.pecan_wsgi.hooks.translation
ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pecan/core.py", line 683, in __call__
ERROR neutron.pecan_wsgi.hooks.translation self.invoke_controller(controller, args, kwargs, state)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pecan/core.py", line 574, in invoke_controller
ERROR neutron.pecan_wsgi.hooks.translation result = controller(*args, **kwargs)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/neutron_lib/db/api.py", line 139, in wrapped
ERROR neutron.pecan_wsgi.hooks.translation setattr(e, '_RETRY_EXCEEDED', True)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/six.py", line 693, in reraise
ERROR neutron.pecan_wsgi.hooks.translation raise value
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/neutron_lib/db/api.py", line 135, in wrapped
ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_db/api.py", line 154, in wrapper
ERROR neutron.pecan_wsgi.hooks.translation ectxt.value = e.inner_exc
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/six.py", line 693, in reraise
ERROR neutron.pecan_wsgi.hooks.translation raise value
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_db/api.py", line 142, in wrapper
ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/neutron_lib/db/api.py", line 183, in wrapped
ERROR neutron.pecan_wsgi.hooks.translation LOG.debug("Retry wrapper got retriable exception: %s", e)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
ERROR neutron.pecan_wsgi.hooks.translation self.force_reraise()
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
ERROR neutron.pecan_wsgi.hooks.translation six.reraise(self.type_, self.value, self.tb)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/six.py", line 693, in reraise
ERROR neutron.pecan_wsgi.hooks.translation raise value
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/neutron_lib/db/api.py", line 179, in wrapped
ERROR neutron.pecan_wsgi.hooks.translation return f(*dup_args, **dup_kwargs)
ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/pecan_wsgi/controllers/utils.py", line 76, in wrapped
ERROR neutron.pecan_wsgi.hooks.translation return f(*args, **kwargs)
ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/pecan_wsgi/controllers/resource.py", line 159, in post
ERROR neutron.pecan_wsgi.hooks.translation return self.create(resources)
ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/pecan_wsgi/controllers/resource.py", line 177, in create
ERROR neutron.pecan_wsgi.hooks.translation return {key: creator(*creator_args, **creator_kwargs)}
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/oslo_log/helpers.py", line 67, in wrapper
ERROR neutron.pecan_wsgi.hooks.translation return method(*args, **kwargs)
ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/services/network_segment_range/plugin.py", line 147, in create_network_segment_range
ERROR neutron.pecan_wsgi.hooks.translation range_data)
ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/services/network_segment_range/plugin.py", line 85, in _validate_network_segment_range_overlap
ERROR neutron.pecan_wsgi.hooks.translation context, **filters)
ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/objects/base.py", line 640, in get_objects
ERROR neutron.pecan_wsgi.hooks.translation cls, context, _pager=_pager, **cls.modify_fields_to_db(kwargs))
ERROR neutron.pecan_wsgi.hooks.translation File "/opt/stack/neutron/neutron/objects/db/api.py", line 52, in get_objects
ERROR neutron.pecan_wsgi.hooks.translation **(_pager.to_kwargs(context, obj_cls) if _pager else {}))
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/neutron_lib/db/model_query.py", line 308, in get_collection
ERROR neutron.pecan_wsgi.hooks.translation for c in query
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 3081, in __iter__
ERROR neutron.pecan_wsgi.hooks.translation return self._execute_and_instances(context)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 3106, in _execute_and_instances
ERROR neutron.pecan_wsgi.hooks.translation result = conn.execute(querycontext.statement, self._params)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 980, in execute
ERROR neutron.pecan_wsgi.hooks.translation return meth(self, multiparams, params)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/sql/elements.py", line 273, in _execute_on_connection
ERROR neutron.pecan_wsgi.hooks.translation return connection._execute_clauseelement(self, multiparams, params)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1099, in _execute_clauseelement
ERROR neutron.pecan_wsgi.hooks.translation distilled_params,
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1240, in _execute_context
ERROR neutron.pecan_wsgi.hooks.translation e, statement, parameters, cursor, context
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception
ERROR neutron.pecan_wsgi.hooks.translation util.raise_from_cause(newraise, exc_info)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause
ERROR neutron.pecan_wsgi.hooks.translation reraise(type(exception), exception, tb=exc_tb, cause=cause)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 276, in reraise
ERROR neutron.pecan_wsgi.hooks.translation raise value.with_traceback(tb)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
ERROR neutron.pecan_wsgi.hooks.translation cursor, statement, parameters, context
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
ERROR neutron.pecan_wsgi.hooks.translation cursor.execute(statement, parameters)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 168, in execute
ERROR neutron.pecan_wsgi.hooks.translation query = self.mogrify(query, args)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 147, in mogrify
ERROR neutron.pecan_wsgi.hooks.translation query = query % self._escape_args(args, conn)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 127, in _escape_args
ERROR neutron.pecan_wsgi.hooks.translation return {key: conn.literal(val) for (key, val) in args.items()}
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 127, in <dictcomp>
ERROR neutron.pecan_wsgi.hooks.translation return {key: conn.literal(val) for (key, val) in args.items()}
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 467, in literal
ERROR neutron.pecan_wsgi.hooks.translation return self.escape(obj, self.encoders)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 460, in escape
ERROR neutron.pecan_wsgi.hooks.translation return converters.escape_item(obj, self.charset, mapping=mapping)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 27, in escape_item
ERROR neutron.pecan_wsgi.hooks.translation val = encoder(val, mapping)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 118, in escape_unicode
ERROR neutron.pecan_wsgi.hooks.translation return u"'%s'" % _escape_unicode(value)
ERROR neutron.pecan_wsgi.hooks.translation File "/usr/local/lib/python3.6/dist-packages/pymysql/converters.py", line 73, in _escape_unicode
ERROR neutron.pecan_wsgi.hooks.translation return value.translate(_escape_table)
ERROR neutron.pecan_wsgi.hooks.translation oslo_db.exception.DBError: 'Sentinel' object has no attribute 'translate'
ERROR neutron.pecan_wsgi.hooks.translation

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.openstack.org/650245

Changed in neutron:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.openstack.org/650245
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=84ba64a6a6ede880fe3d399743343236946369fb
Submitter: Zuul
Branch: master

commit 84ba64a6a6ede880fe3d399743343236946369fb
Author: Slawek Kaplonski <email address hidden>
Date: Fri Apr 5 10:26:36 2019 +0200

    Fix error 500 during segment range creation

    When new network segment range is created for "vlan" network,
    specify physical network is required.
    It wasn't checked so there was ugly error 500 returned to the user
    and ugly stacktrace in neutron logs.

    Now it is validated and error 400 with proper description of
    what is missing is returned.

    Change-Id: Id3809a62f0e5d74949b34788b08af2e2aec879d8
    Closes-Bug: #1823297

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.openstack.org/651108

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/stein)

Reviewed: https://review.openstack.org/651108
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=6ef02c9591b7a0b9710064b848f187741c21585c
Submitter: Zuul
Branch: stable/stein

commit 6ef02c9591b7a0b9710064b848f187741c21585c
Author: Slawek Kaplonski <email address hidden>
Date: Fri Apr 5 10:26:36 2019 +0200

    Fix error 500 during segment range creation

    When new network segment range is created for "vlan" network,
    specify physical network is required.
    It wasn't checked so there was ugly error 500 returned to the user
    and ugly stacktrace in neutron logs.

    Now it is validated and error 400 with proper description of
    what is missing is returned.

    Change-Id: Id3809a62f0e5d74949b34788b08af2e2aec879d8
    Closes-Bug: #1823297
    (cherry picked from commit 84ba64a6a6ede880fe3d399743343236946369fb)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 14.0.1

This issue was fixed in the openstack/neutron 14.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 15.0.0.0b1

This issue was fixed in the openstack/neutron 15.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers