[action] [PR:203] [NPU-driven HA] Ack standalone before peer activates dead role#204
Merged
Merged
Conversation
### Description of PR Summary: During a planned shutdown of a standby HA scope, the active side previously gated its transition from `Active` to `Standalone` on the standby peer entering the `Dead` role. This ordering is incorrect: the active must ack the standalone role **first** so that it owns all traffic before the standby activates its dead role. Otherwise there is a window where the active is still in `SwitchingToStandalone` while the standby has already dropped out, leaving traffic unowned / inline sync unacked. This PR flips the ordering so the active acks standalone first, and the standby only activates its dead role after observing the active's standalone ack. Fixes # (N/A) ### Type of change - [x] Bug fix - [ ] New feature - [ ] Refactor / cleanup - [ ] Documentation update - [ ] Test improvement ### Approach #### What is the motivation for this PR? Correct the NPU-driven HA planned-shutdown state-transition ordering to avoid a traffic-ownership gap between the active and standby HA scopes. #### How did you do it? - **Active side** (`apply_pending_state_side_effects`, `SwitchingToStandalone`): on `PeerShutdownRequested`, enter `Standalone` immediately instead of waiting for the peer to become `Dead`. - **Standby side** (`next_state`): gate the transition to `Destroying` (dead-role activation) on the active peer having acked the `standalone` role — both in the forced `Shutdown` path and via a new `Standby` branch that fires when the peer's acked ASIC role becomes `standalone` during a planned shutdown (`desired_ha_state == Dead`). #### How did you verify/test it? - Updated the affected NPU-driven unit tests (`ha_scope_npu_launch_to_standby_then_down`, `ha_scope_npu_active_to_standalone_on_peer_shutdown_and_peer_rejoin`, `ha_scope_npu_standby_planned_shutdown_and_relaunch_to_standby`) to reflect the new ordering. - `cargo test -p hamgrd --bin hamgrd actors::ha_scope` — all 13 tests pass. - `cargo fmt -- --check` clean; `cargo clippy -p hamgrd` reports no new warnings. #### Any platform specific information? NPU-driven HA only. DPU-driven mode is unaffected. ### Documentation N/A — behavior fix aligned with the SmartSwitch HA HLD planned-shutdown flow. Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Author
|
Original PR: #203 |
5 tasks
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Description of PR
Summary:
During a planned shutdown of a standby HA scope, the active side previously gated its transition from
ActivetoStandaloneon the standby peer entering theDeadrole. This ordering is incorrect: the active must ack the standalone role first so that it owns all traffic before the standby activates its dead role. Otherwise there is a window where the active is still inSwitchingToStandalonewhile the standby has already dropped out, leaving traffic unowned / inline sync unacked.This PR flips the ordering so the active acks standalone first, and the standby only activates its dead role after observing the active's standalone ack.
Fixes # (N/A)
Type of change
Approach
What is the motivation for this PR?
Correct the NPU-driven HA planned-shutdown state-transition ordering to avoid a traffic-ownership gap between the active and standby HA scopes.
How did you do it?
apply_pending_state_side_effects,SwitchingToStandalone): onPeerShutdownRequested, enterStandaloneimmediately instead of waiting for the peer to becomeDead.next_state): gate the transition toDestroying(dead-role activation) on the active peer having acked thestandalonerole — both in the forcedShutdownpath and via a newStandbybranch that fires when the peer's acked ASIC role becomesstandaloneduring a planned shutdown (desired_ha_state == Dead).How did you verify/test it?
ha_scope_npu_launch_to_standby_then_down,ha_scope_npu_active_to_standalone_on_peer_shutdown_and_peer_rejoin,ha_scope_npu_standby_planned_shutdown_and_relaunch_to_standby) to reflect the new ordering.cargo test -p hamgrd --bin hamgrd actors::ha_scope— all 13 tests pass.cargo fmt -- --checkclean;cargo clippy -p hamgrdreports no new warnings.Any platform specific information?
NPU-driven HA only. DPU-driven mode is unaffected.
Documentation
N/A — behavior fix aligned with the SmartSwitch HA HLD planned-shutdown flow.
Signed-off-by: Sonic Build Admin sonicbld@microsoft.com