neutron: refreshing vif model for a server gets the same network multiple times

Bug #1838817 reported by Matt Riedemann on 2019-08-02
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Matt Riedemann

Bug Description

As of this change in Rocky:

When refreshing the vif model for an instance, e.g. when we get a network-changed event with a specific port ID:

Aug 02 18:35:50.884613 ubuntu-bionic-vexxhost-sjc1-0009723918 nova-compute[20428]: DEBUG [req-1a4c2dbf-df86-4044-a59f-f751a53c5ea6 req-b0e1e2f7-d126-4e55-909d-4803816ca80f service nova] [instance: 5bbe0419-fbeb-4667-8c56-785fdc1d0a62] Refreshing network info cache for port 252040d6-4469-46ec-88c3-85e599a43104 {{(pid=20428) _get_instance_nw_info /opt/stack/nova/nova/network/neutronv2/}}

We get the network for the port multiple times, first here:

And then we pass that list of 1 network dict to _build_vif_model here:

and pass it to _nw_info_build_network here:

Which then calls _get_physnet_tunneled_info which gets the network again here:

and/or here:

Furthermore, when we're doing forced _heal_instance_info_cache (stein+) we'll refresh the vif model for all ports that are currently attached to the server:

And rebuild the vif model per port here:

If there is more than one port on the same network attached to the server, we'll be calling show_network for each port even though we're getting the same data when those ports are on the same network.

I noticed this while checking some osprofiler results and noticed the network-changed event on the port-targeted refresh took a relatively long time:

Matt Riedemann (mriedem) on 2019-08-02
Changed in nova:
status: New → Triaged
importance: Undecided → Medium
assignee: nobody → Matt Riedemann (mriedem)
Matt Riedemann (mriedem) wrote :

There are similar inefficiencies here:

The former in the case we have multiple ports on the same network, the latter if we have a server create request with multiple instances of the same network (the user is telling nova to create multiple ports on the same network).

Fix proposed to branch: master

Changed in nova:
status: Triaged → In Progress
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers