hamgrd: prefer standalone scope over stale active state - #211
Merged
vivekrnv merged 1 commit intoJul 29, 2026
Conversation
Signed-off-by: BYGX-wcr <wcr@live.cn>
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR adjusts hamgrd’s HA-scope-based vDPU route-primary selection to prefer a Standalone scope over a (potentially stale) cached Active peer scope, ensuring VNET route primaries align with the standalone “winner” during NPU-driven HA recovery.
Changes:
- Reorders selection logic in
select_vdpu_ids_from_ha_scope_states()so Standalone states are evaluated before Active states. - Adds a focused unit test covering the “stale Active vs local Standalone” scenario.
- Updates the NPU-mode actor test to model the peer becoming Active before the local scope transitions to Standalone, and adjusts expected VNET route programming accordingly.
vivekrnv
approved these changes
Jul 29, 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.
Description of PR
Summary:
Prefer a Standalone HA scope when the cached scope states also contain a stale Active peer. This keeps the VNET route primary aligned with the standalone winner during NPU-driven HA recovery.
Type of change
Approach
What is the motivation for this PR?
The route selector evaluated a unique Active state before Standalone states. After a local scope transitions to Standalone, a cached peer Active state could therefore remain selected as the VNET route primary.
How did you do it?
Evaluate Standalone states before Active states, add focused unit coverage for the stale-Active scenario, and update the actor test to model a peer becoming Active before the local scope becomes Standalone.
How did you verify/test it?
cargo test -p hamgrd ha_scope_route_selectioncargo build --workspace --all-featurescargo fmt --check --allcargo test --workspace --all-featuresAny platform specific information?
Validated in the
sonic-dash-habuild container.Documentation
Not applicable; this corrects route-selection behavior and adds test coverage.