Skip to content

hamgrd: prefer standalone scope over stale active state - #211

Merged
vivekrnv merged 1 commit into
sonic-net:masterfrom
BYGX-wcr:fix/npu-ha-standalone-priority
Jul 29, 2026
Merged

hamgrd: prefer standalone scope over stale active state#211
vivekrnv merged 1 commit into
sonic-net:masterfrom
BYGX-wcr:fix/npu-ha-standalone-priority

Conversation

@BYGX-wcr

Copy link
Copy Markdown
Contributor

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

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Documentation update
  • Test improvement

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_selection
  • cargo build --workspace --all-features
  • cargo fmt --check --all
  • cargo test --workspace --all-features

Any platform specific information?

Validated in the sonic-dash-ha build container.

Documentation

Not applicable; this corrects route-selection behavior and adds test coverage.

Signed-off-by: BYGX-wcr <wcr@live.cn>
Copilot AI review requested due to automatic review settings July 28, 2026 22:08
@mssonicbld

Copy link
Copy Markdown

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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
vivekrnv merged commit f53422a into sonic-net:master Jul 29, 2026
4 checks passed
@BYGX-wcr
BYGX-wcr deleted the fix/npu-ha-standalone-priority branch August 4, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants