l2_pop does unnecessary db fetches for incompatible network types

Bug #1983558 reported by Weronika Sikora
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Unassigned

Bug Description

When processing ports that are "incompatible" with the l2_population driver (vlan and flat network types), certain methods do unnecessary db calls to retrieve agent port info:

l2pop_db.get_agent_network_active_port_count()

The methods that call this are in the neutron/plugins/ml2/drivers/l2pop/mech_driver.py file and are:

update_port_up()
_get_agent_fdb ()

The second method is called from within update_port_down(). So the affected methods seem to get called for every single port, at least once each. That's a lot of unnecessary db calls.

The info retrieved from the db is used later in these methods, but only if the processed port is of the correct network type (vxlan, gre). It's not used if the network type is vlan or flat.

There is a check if the network type is "compatible", but it's done after the db call and before the info is used. So this makes this db fetch completely unnecessary if the network type turns out to be vlan or flat. It should be moved below the network type check to avoid unnecessary fetches.

I've finished a patch to fix this issue and will upload it shortly for review.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/neutron/+/852089

Changed in neutron:
status: New → In Progress
Changed in neutron:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)

Reviewed: https://review.opendev.org/c/openstack/neutron/+/852089
Committed: https://opendev.org/openstack/neutron/commit/a45cebbfcd154fbd94c4625c5092d296959bb829
Submitter: "Zuul (22348)"
Branch: master

commit a45cebbfcd154fbd94c4625c5092d296959bb829
Author: Weronika Sikora <email address hidden>
Date: Mon Aug 1 05:13:50 2022 +0000

    Avoid unnecessary db calls with l2pop

    When processing ports that are incompatible with l2_population,
    certain methods do unnecessary db calls to retrieve agent port
    info from the db. This info is used only if the processed
    port is of the correct network type. The check is done after
    the db call, but before the info is used.

    This commit moves the check earlier in the method. The db will
    be called only when the port is supposed to be set up with the
    l2pop.

    Closes-Bug: #1983558
    Change-Id: I5a83bfce60a933af781b1fd96037c7de6b2b1f38

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 21.0.0.0rc1

This issue was fixed in the openstack/neutron 21.0.0.0rc1 release candidate.

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.