network_segment_ranges could not load in tricirlce test

Bug #1821567 reported by ZhangChi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Tricircle
Fix Committed
Undecided
ZhangChi

Bug Description

after Use network segment ranges for segment allocation https://github.com/openstack/neutron/commit/a01b7125cd965625316d9aec3a7408612b94fc08#diff-441e123742581c5d1da67bf722508f1bR121 merged in neutron

many network unitest could not passed in tricirlce

the detail info as follows:

stack@trio-top:~/tricircle$ sudo stestr run tricircle.tests.unit.network.test_segment_plugin.PluginTest.test_create_segment
Could not load 'NetworkSegmentRange': 'module' object has no attribute 'NetworkSegmentRange'
Could not load 'NetworkSegmentRange': 'module' object has no attribute 'NetworkSegmentRange'
Using RPC transport for notifications. Please use get_notification_transport to obtain a notification transport instance.
Using RPC transport for notifications. Please use get_notification_transport to obtain a notification transport instance.
Using RPC transport for notifications. Please use get_notification_transport to obtain a notification transport instance.
{0} tricircle.tests.unit.network.test_segment_plugin.PluginTest.test_create_segment [0.399660s] ... FAILED

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/mock/mock.py", line 1305, in patched
        return func(*args, **keywargs)
      File "tricircle/tests/unit/network/test_segment_plugin.py", line 228, in test_create_segment
        fake_plugin.central_plugin.create_network(neutron_context, network)
      File "tricircle/tests/unit/network/test_central_plugin.py", line 825, in create_network
        net = super(FakePlugin, self).create_network(context, network)
      File "tricircle/network/central_plugin.py", line 322, in create_network
        tenant_id)
      File "tricircle/network/managers.py", line 65, in create_network_segments
        segments = self._process_provider_create(network)
      File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 116, in _process_provider_create
        return [self._process_provider_segment(segment)]
      File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 102, in _process_provider_segment
        self.validate_provider_segment(segment)
      File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 258, in validate_provider_segment
        driver.obj.validate_provider_segment(segment)
      File "/opt/stack/neutron/neutron/plugins/ml2/drivers/type_vlan.py", line 238, in validate_provider_segment
        ranges = self.get_network_segment_ranges()
      File "/opt/stack/neutron/neutron/plugins/ml2/drivers/type_vlan.py", line 228, in get_network_segment_ranges
        ranges = self._get_network_segment_ranges_from_db()
      File "/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py", line 139, in wrapped
        setattr(e, '_RETRY_EXCEEDED', True)
      File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
        self.force_reraise()
      File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
        six.reraise(self.type_, self.value, self.tb)
      File "/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py", line 135, in wrapped
        return f(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 154, in wrapper
        ectxt.value = e.inner_exc
      File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
        self.force_reraise()
      File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
        six.reraise(self.type_, self.value, self.tb)
      File "/usr/local/lib/python2.7/dist-packages/oslo_db/api.py", line 142, in wrapper
        return f(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py", line 183, in wrapped
        LOG.debug("Retry wrapper got retriable exception: %s", e)
      File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
        self.force_reraise()
      File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
        six.reraise(self.type_, self.value, self.tb)
      File "/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py", line 179, in wrapped
        return f(*dup_args, **dup_kwargs)
      File "/opt/stack/neutron/neutron/plugins/ml2/drivers/type_vlan.py", line 182, in _get_network_segment_ranges_from_db
        ctx, network_type=self.get_type()))
      File "/opt/stack/neutron/neutron/objects/base.py", line 640, in get_objects
        cls, context, _pager=_pager, **cls.modify_fields_to_db(kwargs))
      File "/opt/stack/neutron/neutron/objects/db/api.py", line 52, in get_objects
        **(_pager.to_kwargs(context, obj_cls) if _pager else {}))
      File "/usr/local/lib/python2.7/dist-packages/neutron_lib/db/model_query.py", line 308, in get_collection
        for c in query
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 3081, in __iter__
        return self._execute_and_instances(context)
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 3106, in _execute_and_instances
        result = conn.execute(querycontext.statement, self._params)
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 980, in execute
        return meth(self, multiparams, params)
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 273, in _execute_on_connection
        return connection._execute_clauseelement(self, multiparams, params)
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1099, in _execute_clauseelement
        distilled_params,
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1240, in _execute_context
        e, statement, parameters, cursor, context
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1456, in _handle_dbapi_exception
        util.raise_from_cause(newraise, exc_info)
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 296, in raise_from_cause
        reraise(type(exception), exception, tb=exc_tb, cause=cause)
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1236, in _execute_context
        cursor, statement, parameters, context
      File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 536, in do_execute
        cursor.execute(statement, parameters)
    oslo_db.exception.DBNonExistentTable: (sqlite3.OperationalError) no such table: network_segment_ranges [SQL: u'SELECT network_segment_ranges.id AS network_segment_ranges_id, network_segment_ranges.name AS network_segment_ranges_name, network_segment_ranges."default" AS network_segment_ranges_default, network_segment_ranges.shared AS network_segment_ranges_shared, network_segment_ranges.project_id AS network_segment_ranges_project_id, network_segment_ranges.network_type AS network_segment_ranges_network_type, network_segment_ranges.physical_network AS network_segment_ranges_physical_network, network_segment_ranges.minimum AS network_segment_ranges_minimum, network_segment_ranges.maximum AS network_segment_ranges_maximum, network_segment_ranges.standard_attr_id AS network_segment_ranges_standard_attr_id, standardattributes_1.id AS standardattributes_1_id, standardattributes_1.resource_type AS standardattributes_1_resource_type, standardattributes_1.description AS standardattributes_1_description, standardattributes_1.revision_number AS standardattributes_1_revision_number, standardattributes_1.created_at AS standardattributes_1_created_at, standardattributes_1.updated_at AS standardattributes_1_updated_at \nFROM network_segment_ranges LEFT OUTER JOIN standardattributes AS standardattributes_1 ON standardattributes_1.id = network_segment_ranges.standard_attr_id \nWHERE network_segment_ranges.network_type IN (?)'] [parameters: ('vlan',)] (Background on this error at: http://sqlalche.me/e/e3q8)

Tags: gate-failure
tags: added: gate-failure
Revision history for this message
Bence Romsics (bence-romsics) wrote :

It seems to me the broken tricircle gate was worked around by removing the failing tests here: https://review.openstack.org/647274

Revision history for this message
Bence Romsics (bence-romsics) wrote :

Slawek, you added the gate-failure tag for tricircle, right? The neutron gate does not seem to be broken by this.

While I don't understand the tricircle test environment yet, it seems to me tricircle should adapt to neutron to fix this and not the other way around because tricircle depends on private neutron methods:

      File "tricircle/network/managers.py", line 65, in create_network_segments
        segments = self._process_provider_create(network)
      File "/opt/stack/neutron/neutron/plugins/ml2/managers.py", line 116, in _process_provider_create
        return [self._process_provider_segment(segment)]

So maybe we can remove neutron from the list of affected components? Do we know of any other networking-* project which may be broken? The first handful errors I've seen in kibana all came from tricircle.

Revision history for this message
Slawek Kaplonski (slaweq) wrote :

@Bence: yes, I added it according to Tricircle. In Neutron gates are fine (at least regarding this issue :))

Revision history for this message
Miguel Lavalle (minsel) wrote :

Looking at your traceback above, we see that the failure happens in this line:

File "/opt/stack/neutron/neutron/plugins/ml2/drivers/type_vlan.py", line 228, in get_network_segment_ranges
        ranges = self._get_network_segment_ranges_from_db()

Looking at the code, we an see that this line is executed only if the network segments range service plugin is configured:

https://github.com/openstack/neutron/blob/master/neutron/plugins/ml2/drivers/type_vlan.py#L227-L228

For the segments ranges service plugin to be loaded, you have to explicitly configure it: https://docs.openstack.org/neutron/latest/admin/config-network-segment-ranges.html#controller-node

So the question really is why are you configuring the service plugin in your zuul jobs if the project's DB has not been prepared to support it?

Marking it incomplete until we hear back from submitter

Changed in neutron:
status: New → Incomplete
tags: removed: neutron
Revision history for this message
ZhangChi (chzhang8) wrote :

Thanks @Miguel Lavalle (minsel)
https://review.opendev.org/#/c/655625/

Changed in tricircle:
status: New → Fix Committed
assignee: nobody → ZhangChi (chzhang8)
no longer affects: neutron
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.