Skip to content

Conversation

@haseebsyed12
Copy link
Contributor

@haseebsyed12 haseebsyed12 commented Nov 6, 2025

Dynamic Network Node Trunk Discovery

Implements automatic discovery of the network node trunk ID via OVN Gateway agent, eliminating the need for manual configuration.

Problem

Previously, the network node trunk ID had to be hardcoded.

Solution

Added fetch_network_node_trunk_id() function that dynamically discovers the trunk by:

  1. Get OVN Controller Gateway agent host UUID - Queries for alive OVN Controller Gateway agents
  2. Finding gateway ports - Queries ports bound to the gateway agent host (filter ovn controller gateway agent host_uuid= port binding_host_id)
  3. Locating the trunk - Finds the trunk whose parent port matches a gateway port (filter trunk Parent Port = filtered port_id)

Equivalent openstack cli commands network_trunk_id.sh

@haseebsyed12 haseebsyed12 force-pushed the puc-1297-dynamic-lookup-network-node branch 2 times, most recently from 0a15219 to e72d9aa Compare November 7, 2025 10:51
@haseebsyed12 haseebsyed12 requested a review from a team November 7, 2025 10:51
@haseebsyed12 haseebsyed12 marked this pull request as ready for review November 7, 2025 11:05
@haseebsyed12 haseebsyed12 force-pushed the puc-1297-dynamic-lookup-network-node branch from e72d9aa to cfbcc73 Compare November 7, 2025 17:12
Copy link
Contributor

@cardoe cardoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly the big O on this is gonna be costly. I would change this around to not get all trunks and walk them and call Ironic over and over again. You can call Ironic once for the gateway node to get its ID then get the ports owned by that ID. Then get the trunks owned by those ports. Now you've got a much smaller list to iterate over.

In the current code if we have 1000 trunk ports (which isn't even the possible max for a site) you would make 1000 calls to Ironic inside of a function that's expected to complete in 20 seconds or less.

@haseebsyed12 haseebsyed12 force-pushed the puc-1297-dynamic-lookup-network-node branch 2 times, most recently from 637d1ea to 2d5f218 Compare November 11, 2025 15:56
@haseebsyed12 haseebsyed12 force-pushed the puc-1297-dynamic-lookup-network-node branch 2 times, most recently from 98e232d to 3813b60 Compare November 11, 2025 17:00

# Get all ports and filter by binding_host_id
# Note: Port.get_objects doesn't support filtering by binding_host_id directly
all_ports = port_obj.Port.get_objects(context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be insanely expensive as well as things scale as well. I'll have to look through what a better filter is going to be.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now querying PortBinding objects for each host

@haseebsyed12 haseebsyed12 force-pushed the puc-1297-dynamic-lookup-network-node branch 2 times, most recently from 8b2d497 to 36b0d96 Compare November 12, 2025 10:50
@haseebsyed12 haseebsyed12 requested a review from cardoe November 12, 2025 12:22
@haseebsyed12 haseebsyed12 force-pushed the puc-1297-dynamic-lookup-network-node branch from 36b0d96 to 6597cbb Compare November 20, 2025 16:27
Previously, the network node trunk ID had to be manually configured in ml2 config. This had operational overhead and made the system less flexible when underling nodes used to deploy neutron is changed.
@haseebsyed12 haseebsyed12 force-pushed the puc-1297-dynamic-lookup-network-node branch from 6597cbb to 5119646 Compare November 21, 2025 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants