Comment 0 for bug 2019859

Revision history for this message
Corey Bryant (corey.bryant) wrote :

neutron.tests.unit.objects.test_ports.PortBindingDbObjectTestCase.test_get_duplicated_port_bindings fails on stable/xena with:
NotImplementedError: Operator 'getitem' is not supported on this expression

The code introduced in commit 2fb9ddb01ed44fae19c0184baa8620e95e51e344 [1] appears to depend on a sqlalchemy version that is higher than the minimum version specified in requirements.txt.

[1]

commit 2fb9ddb01ed44fae19c0184baa8620e95e51e344
Author: Rodolfo Alonso Hernandez <email address hidden>
Date: Mon Dec 12 05:10:01 2022 +0100

    Delete the PB level registers when deleting the duplicated PB

    The ``neutron-remove-duplicated-port-bindings`` script removes the
    duplicated port binding registers ("ml2_port_bindings" table) that
    have status=INACTIVE.

    This patch also removes the corresponding port binding levels
    ("ml2_port_binding_levels" table) associated to those inactive port
    bindings.

    Closes-Bug: #2000078

    Change-Id: I12fa0764cd0ff509f1859b61060d64cc5a54a7b9
    (cherry picked from commit 572185e1fd252772d8baaec099bf8bedfc837013)
    (cherry picked from commit 07855a68266484ae187c76708a727b8a4db1e2e2)

To recreate:

root@f1:~/neutron# git remote -v
origin https://opendev.org/openstack/neutron (fetch)
origin https://opendev.org/openstack/neutron (push)

root@f1:~/neutron# git branch
* (HEAD detached at 19.7.0)
  master
  stable/xena

root@f1:~/neutron# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal

root@f1:~/neutron# tox -e py3 --notest
  ...
  py3: OK (22.37 seconds)
  congratulations :) (22.46 seconds)

root@f1:~/neutron# .tox/py3/bin/pip3 freeze | grep -i -E 'oslo.db|sqlalchemy'
oslo.db==11.0.0
SQLAlchemy==1.4.23
sqlalchemy-migrate==0.13.0

root@f1:~/neutron# grep -i -E 'oslo.db|sqlalchemy' requirements.txt
SQLAlchemy>=1.3.23 # MIT
oslo.db>=4.44.0 # Apache-2.0

root@f1:~/neutron# .tox/py3/bin/pip3 install oslo.db==4.44.0 SQLAlchemy==1.3.23
...
Successfully installed SQLAlchemy-1.3.23 oslo.db-4.44.0

root@f1:~/neutron# tox -e py3 -- neutron.tests.unit.objects.test_ports.PortBindingDbObjectTestCase.test_get_duplicated_port_bindings
...
{0} neutron.tests.unit.objects.test_ports.PortBindingDbObjectTestCase.test_get_duplicated_port_bindings [0.367953s] ... FAILED [117/27872]

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File "/root/neutron/neutron/tests/base.py", line 183, in func
    return f(self, *args, **kwargs)

      File "/root/neutron/neutron/tests/unit/objects/test_ports.py", line 68, in test_get_duplicated_port_bindings
    dup_pb = ports.PortBinding.get_duplicated_port_bindings(self.context)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 1012, in wrapper
    return fn(*args, **kwargs)

      File "/root/neutron/neutron/objects/ports.py", line 115, in get_duplicated_port_bindings
    sqlalchemy.select(cls.db_model.port_id).

      File "<string>", line 2, in select

      File "<string>", line 2, in __init__

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/util/deprecations.py", line 139, in warned
    return fn(*args, **kwargs)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/selectable.py", line 3114, in __init__
    for c in columns:

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/operators.py", line 432, in __getitem__
    return self.operate(getitem, index)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 226, in operate
    return op(self.comparator, *other, **kwargs)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/operators.py", line 432, in __getitem__
    return self.operate(getitem, index)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/orm/properties.py", line 367, in operate
    return op(self.__clause_element__(), *other, **kwargs)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/operators.py", line 432, in __getitem__
    return self.operate(getitem, index)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 762, in operate
    return op(self.comparator, *other, **kwargs)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/operators.py", line 432, in __getitem__
    return self.operate(getitem, index)

      File "<string>", line 1, in <lambda>

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/type_api.py", line 67, in operate
    return o[0](self.expr, op, *(other + o[1:]), **kwargs)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/default_comparator.py", line 237, in _getitem_impl
    _unsupported_impl(expr, op, other, **kw)

      File "/root/neutron/.tox/py3/lib/python3.8/site-packages/sqlalchemy/sql/default_comparator.py", line 241, in _unsupported_impl
    raise NotImplementedError(

    NotImplementedError: Operator 'getitem' is not supported on this expression