Skip to content

fix: include VXLAN persistent networks in cleanup resource dispatch - #13968

Open
waterWang wants to merge 1 commit into
apache:mainfrom
waterWang:fix/vxlan-persistent-network-cleanup
Open

fix: include VXLAN persistent networks in cleanup resource dispatch#13968
waterWang wants to merge 1 commit into
apache:mainfrom
waterWang:fix/vxlan-persistent-network-cleanup

Conversation

@waterWang

Copy link
Copy Markdown

Description

Fixes #13966

cleanupPersistentnNetworkResources() only sent CleanupPersistentNetworkResourceCommand for networks whose broadcast URI scheme was vlan. For vxlan:// persistent networks the cleanup command was never dispatched, so bridges and VXLAN interfaces were left behind on every host that never ran a VM on the network.

setupPersistentNetwork() in DefaultHostListener creates resources for all persistent networks from getAllPersistentNetworksFromZone() with no isolation-method filter, so the removal path must accept both Vlan and Vxlan schemes to stay symmetric.

Changes

  • engine/orchestration/.../NetworkOrchestrator.java: networkMeetsPersistenceCriteria() now accepts both BroadcastDomainType.Vlan and BroadcastDomainType.Vxlan broadcast URI schemes (extracted to a local broadcastDomainType variable for null-safety and readability).

Testing

  • Code-level change only; the condition now matches the persistence criteria used at creation time for VXLAN networks. Verified the broadcast scheme enum values (Vlan("vlan", Integer.class), Vxlan("vxlan", Long.class) in Networks.java).

cleanupPersistentnNetworkResources() only sent CleanupPersistentNetworkResourceCommand
for networks whose broadcast URI scheme is vlan, so vxlan:// persistent networks
leaked bridges and VXLAN interfaces on hosts that never ran a VM on them.
setupPersistentNetwork() creates resources for all persistent networks with no
scheme filter, so the removal path must accept both Vlan and Vxlan schemes.

Fixes apache#13966.
@waterWang
waterWang force-pushed the fix/vxlan-persistent-network-cleanup branch from 1b605a6 to 3a0c98c Compare August 25, 2026 11:10

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this needs to go on LTS branch 4.20 preferably or else 4.22 at least.

}

private boolean networkMeetsPersistenceCriteria(NetworkVO network, NetworkOfferingVO offering, boolean cleanup) {
BroadcastDomainType broadcastDomainType = network.getBroadcastUri() != null ? BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) : null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
BroadcastDomainType broadcastDomainType = network.getBroadcastUri() != null ? BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) : null;
BroadcastDomainType broadcastDomainType = BroadcastDomainType.getSchemeValue(network.getBroadcastUri());

nullcheck is part of the getSchemeValue() contract

Comment on lines 1607 to +1608
boolean criteriaMet = offering.isPersistent() &&
(network.getBroadcastUri() != null && BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) == BroadcastDomainType.Vlan);
(broadcastDomainType == BroadcastDomainType.Vlan || broadcastDomainType == BroadcastDomainType.Vxlan);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it would be nice for readability to use a list of values:

Suggested change
boolean criteriaMet = offering.isPersistent() &&
(network.getBroadcastUri() != null && BroadcastDomainType.getSchemeValue(network.getBroadcastUri()) == BroadcastDomainType.Vlan);
(broadcastDomainType == BroadcastDomainType.Vlan || broadcastDomainType == BroadcastDomainType.Vxlan);
List<BroadcastDomainType> broadcastTypes = Arrays.asList(BroadcastDomainType.Vlan, BroadcastDomainType.Vxlan)
boolean criteriaMet = offering.isPersistent() && broadcastTypes.contains(broadcastDomainType);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VXLAN persistent networks create bridges on hosts that never ran a VM on them, but don't clean them up

2 participants