When doing a openstack port list that filters for a fixed-ip/subnet and at the same time limits the amount of results neutron returns a 500 internal server error. This was already addressed in https://bugs.launchpad.net/neutron/+bug/1826186 but this bug is also present in other places.
While running tempest against a Neutron Queens installation I came across another _get_ports_query() in neutron/plugins/ml2/plugin.py where filter is again called onto the result of an already limited query.
InvalidRequestError: Query.filter() being called on a Query which already has LIMIT or OFFSET applied. To modify the row-limited results of a Query, call from_self() first. Otherwise, call filter() before limit() or offset() are applied.
File "pecan/core.py", line 683, in __call__
self.invoke_controller(controller, args, kwargs, state)
[...]
File "neutron/db/db_base_plugin_v2.py", line 1417, in get_ports
page_reverse=page_reverse)
File "neutron/plugins/ml2/plugin.py", line 1941, in _get_ports_query
query = query.filter(substr_filter)
File "<string>", line 2, in filter
File "sqlalchemy/orm/base.py", line 200, in generate
assertion(self, fn.__name__)
File "sqlalchemy/orm/query.py", line 435, in _no_limit_offset
% (meth, meth)
When doing a grep for _get_ports_query() in the neutron codebase I find a function with this name being called in neutron/db/dvr_mac_db.py in get_ports_on_host_by_subnet(), I do not have a stacktrace or test for that though.
When doing a openstack port list that filters for a fixed-ip/subnet and at the same time limits the amount of results neutron returns a 500 internal server error. This was already addressed in https:/ /bugs.launchpad .net/neutron/ +bug/1826186 but this bug is also present in other places.
While running tempest against a Neutron Queens installation I came across another _get_ports_query() in neutron/ plugins/ ml2/plugin. py where filter is again called onto the result of an already limited query.
See https:/ /github. com/openstack/ neutron/ blob/6f4962dcf8 9aebf2552ee8ec0 993c6389a953024 /neutron/ plugins/ ml2/plugin. py#L2206
InvalidRequestE rror: Query.filter() being called on a Query which already has LIMIT or OFFSET applied. To modify the row-limited results of a Query, call from_self() first. Otherwise, call filter() before limit() or offset() are applied. invoke_ controller( controller, args, kwargs, state) db/db_base_ plugin_ v2.py", line 1417, in get_ports reverse= page_reverse) plugins/ ml2/plugin. py", line 1941, in _get_ports_query substr_ filter) orm/base. py", line 200, in generate orm/query. py", line 435, in _no_limit_offset
File "pecan/core.py", line 683, in __call__
self.
[...]
File "neutron/
page_
File "neutron/
query = query.filter(
File "<string>", line 2, in filter
File "sqlalchemy/
assertion(self, fn.__name__)
File "sqlalchemy/
% (meth, meth)
I applied a patch similar to the one Gabriele Cerami proposed in https:/ /review. opendev. org/#/c/ 656066/
When doing a grep for _get_ports_query() in the neutron codebase I find a function with this name being called in neutron/ db/dvr_ mac_db. py in get_ports_ on_host_ by_subnet( ), I do not have a stacktrace or test for that though.
See https:/ /github. com/openstack/ neutron/ blob/6f4962dcf8 9aebf2552ee8ec0 993c6389a953024 /neutron/ db/dvr_ mac_db. py#L162