← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1804259] Re: DB: sorting on elements which are AssociationProxy fails

 

See the patch: https://review.opendev.org/#/c/653903/

** Changed in: neutron
       Status: Confirmed => Fix Released

** Changed in: neutron
     Assignee: (unassigned) => pandatt (pandatt)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1804259

Title:
  DB: sorting on elements which are AssociationProxy fails

Status in neutron:
  Fix Released

Bug description:
  If I do a DB query trying to sort by a column which is an
  AssociationProxy I get the following exception:

  
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers   File "/opt/stack/neutron/neutron/db/db_base_plugin_v2.py", line 1438, in get_ports
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers     page_reverse=page_reverse)
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers   File "/opt/stack/neutron/neutron/plugins/ml2/plugin.py", line 1935, in _get_ports_qu
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers     *args, **kwargs)
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers   File "/opt/stack/neutron/neutron/db/db_base_plugin_v2.py", line 1418, in _get_ports_
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers     *args, **kwargs)
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers   File "/opt/stack/neutron/neutron/db/_model_query.py", line 159, in get_collection_qu
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers     sort_keys = db_utils.get_and_validate_sort_keys(sorts, model)
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers   File "/usr/lib/python2.7/site-packages/neutron_lib/db/utils.py", line 45, in get_and
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers     if isinstance(sort_key_attr.property,
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers AttributeError: 'AssociationProxy' object has no attribute 'property'
  Nov 20 14:41:20 centos.rdocloud neutron-server[11934]: ERROR neutron.plugins.ml2.managers

  
  This is reproducible for example by querying ports sorted by 'created_at' attribute:

  ports = self._plugin.get_ports(context, sorts=[('created_at', True)])

  
  Looks like we may need to special case the AssociationProxy columns such as we already do in the filtering code at:

  https://github.com/openstack/neutron/blob/0bb6136919a31751242d2efbefedbd8922b6bd0a/neutron/db/_model_query.py#L88

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


References