Repository navigation
fix(neutron): refactor palo_alto to move pure functions out of class PUC-2095 - #2458
Merged
Merged
Conversation
Python test results129 tests 129 ✅ 6s ⏱️ Results for commit 09d8abe. ♻️ This comment has been updated with latest results. |
nidzrai
force-pushed
the
refactor_palo
branch
3 times, most recently
from
October 13, 2026 12:55
2e1a99d to
1b6f471
Compare
Move the wiring into PaloAltoWiring so the wiring reconciler can reuse it.
Undo partial wiring on failure, and reject gateways that can't be wired up front.
nidzrai
force-pushed
the
refactor_palo
branch
from
October 13, 2026 12:56
1b6f471 to
09d8abe
Compare
haseebsyed12
approved these changes
Oct 13, 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.
What does this change do?
palo_alto_wiring.pyis mostly the wiring methods moved out ofpalo_alto.py. While moving them I changed them to takerouter_idinstead of the router dict (they only ever read the id), and gave the class a small public API:ensure_stack,attach_port,cleanup_attachment,snapshot_attachment/undo_attachmentandcheck_can_attach.The tests follow the same split. The wiring tests now build
PaloAltoWiringfrom small fixtures .Gateway attach rolls back on failure. Neutron commits the gateway port before
ROUTER_GATEWAY/AFTER_CREATEand does not undo it when we raise. A failure halfway used to leave the anchor parent port, its VIF on an appliance NIC and sometimes the trunk behind, and runningrouter set --external-gatewayagain did nothing. The handler now snapshots the router's wiring first and undoes only what this request added, using the same snapshot/undo as the interface path.No false success on transient DB errors. Neutron's callback manager turns a retriable error into a
RetryRequest.update_routerthen retries, finds the gateway already created, skips the event and returns 200 for a gateway that is not wired. These errors now come back asPaloAltoGatewayWiringFailed(409), including when an inner retry decorator has already given up.Pre-check before the gateway is created. A read-only check on
ROUTER_GATEWAY/BEFORE_CREATErejects a Palo Alto router with no adopted node, or whose node has no port with bothphysical_networkandlocal_link_connection(PaloAltoNodeHasNoUsablePort, 400). Neutron has not created anything yet at that point, so the same command works once the node is fixed.Inline
BadRequests are now named exceptions. Their messages no longer start with "Bad router request:".Wiring log lines now come from the
neutron_understack.l3_router.palo_alto_wiringlogger.These methods don't use self except to get their inputs , so moving out these pure functions to module level
Added named exception
One router-lookup helper
redundant _has_subport , removed dead _remove_gateway_subport
change _ensure_parent_vif_attached a single exit path (Fetch the port, check Ironic annotated it, return it" lived in both the helper and the main function) , _confirm_parent_vif_attach_after_error returned dict but ideally it should be bool .
Refactor _InterfaceAttachment checks, moved th check out of handler
TODO Dev testing:
physical_network: 400, no anchor parent port created, and the same command works after fixing the port.[TODO ] Not in this PR
The wiring reconciler (neutron: preserve Palo Alto wiring when interface port deletion fails #2328, neutron: roll back Palo Alto interface wiring after post-create failures #2329).
Lookups can still create the anchor network when it is missing.
resource_classis read from every service profile on the flavor, not only the one that selected the driver.Two concurrent attaches on one router can create duplicate parent ports and trunks.
Upgrade impact
upgrade-impactlabel and a release note: runscriv createfrom therepository root and describe the required action in the generated
changelog.d/file. See RELEASING.md.Operator action means anything a deployment has to do beyond a normal resync:
deploy repo or values changes, new or removed secrets, enabling or disabling a
component, or a manual one-time step.