Clean leftover gateway ext-ports before func tests#410
Merged
Conversation
zaza creates an undercloud neutron port <server>_ext-port and attaches it to each gateway instance with interface_attach. nova does not delete such a user-supplied port on teardown - it only detaches it and leaves it behind. juju usually cleans it up - its openstack provider deletes ports filtered by device_id == server - but if nova clears device_id before that query runs, or the port delete errors out, or teardown is forced, the detached port survives on the shared external network. A later test whose floating IP lands on that leaked address then collides with the dead port at L2/ARP and can't reach its guest, so the failure shows up intermittently. Before each model is built, delete ext-ports that are detached or whose device_id points at a gone instance; a port still attached to a live server is left alone. Signed-off-by: Seyeong Kim <seyeong.kim@canonical.com>
e643dfd to
695ee8a
Compare
dosaboy
approved these changes
Jun 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zaza creates an undercloud neutron port _ext-port and attaches it to each gateway instance with interface_attach.
nova does not delete such a user-supplied port on teardown - it only detaches it and leaves it behind.
juju usually cleans it up - its openstack provider deletes ports filtered by device_id == server
but if nova clears device_id before that query runs, or the port delete errors out, or teardown is forced, the detached port survives on the shared external network.
A later test whose floating IP lands on that leaked address then collides with the dead port at L2/ARP and can't reach its guest, so the failure shows up intermittently.
Before each model is built, delete ext-ports that are detached or whose device_id points at a gone instance; a port still attached to a live server is left alone.
This does not fully fix the leak. The teardown is async, so it can miss the port from the last model.
But it cleans old leaked ports before each build, so the collision is much less likely.