Reviewed: https://review.opendev.org/c/openstack/neutron/+/881830 Committed: https://opendev.org/openstack/neutron/commit/9ac59e4b4a3b40861308c71bbacc379dacb2bd20 Submitter: "Zuul (22348)" Branch: master
commit 9ac59e4b4a3b40861308c71bbacc379dacb2bd20 Author: Rodolfo Alonso Hernandez <[email protected]> Date: Fri Apr 28 16:34:22 2023 +0200 Avoid retrieving ports if network list is empty In ``QoSPlugin._get_ports_with_policy``, if the network IDs list is empty, the SQLAlchemy throws the following warning: SELECT statement has a cartesian product between FROM element(s) "subports_1", "ports", "portnumaaffinitypolicies_1", "testportextensions_1", "portuplinkstatuspropagation_1", "portdataplanestatuses_1", "standardattributes_2", "portdeviceprofiles_1", "ml2_port_bindings_1", "portsecuritybindings_1", "portdnses_1", "securitygroupportbindings_1", "qos_network_policy_bindings_1", "qos_port_policy_bindings_1", "trunks_1", "standardattributes_1" and FROM element "networks". Apply join condition(s) between each element to resolve. This patch avoids this query by checking the network IDs list. If the list is empty, the expected port list will be too. This is also a small optimization because we are skipping the port query. This patch is also applying the same logic to the second query in this method. Closes-Bug: #2018000 Change-Id: Ia5380bc78cc1d0136e11cc4692069279419e285e ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/2018000 Title: SQL warning retrieving ports if the network list is empty Status in neutron: Fix Released Bug description: In QoSPlugin._get_ports_with_policy, if the "networks_ids" list is empty, the filter we apply on the SQL query is empty. That throws the following warning [1]. Using the last oslo.db and slqalchemy versions, the message is: SAWarning: SELECT statement has a cartesian product between FROM element(s) "networks" and FROM element "qos_port_policy_bindings_1". Apply join condition(s) between each element to resolve. [1]https://paste.opendev.org/show/bphVO9ULGIXtbC9tVdbd/ To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/2018000/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

