neutron: refreshing vif model for a server gets the same network multiple times
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Confirmed
|
Low
|
Unassigned | ||
Rocky |
Confirmed
|
Low
|
Unassigned | ||
Stein |
Confirmed
|
Low
|
Unassigned |
Bug Description
As of this change in Rocky:
https:/
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-
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_
Which then calls _get_physnet_
and/or here:
Furthermore, when we're doing forced _heal_instance_
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:
Changed in nova: | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Matt Riedemann (mriedem) |
Changed in nova: | |
assignee: | Matt Riedemann (mriedem) → nobody |
importance: | Medium → Low |
status: | In Progress → Confirmed |
There are similar inefficiencies here:
https:/ /github. com/openstack/ nova/blob/ 600ecf3d9a5116d 040cd18023ff270 b91b06247d/ nova/network/ neutronv2/ api.py# L2014
https:/ /github. com/openstack/ nova/blob/ 600ecf3d9a5116d 040cd18023ff270 b91b06247d/ nova/network/ neutronv2/ api.py# L2031
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).