Skip to content

Fix incorrect default value and incorrect operations ordering in NPU state machine#162

Merged
zjswhhh merged 4 commits into
sonic-net:masterfrom
BYGX-wcr:fix-state-machine
May 13, 2026
Merged

Fix incorrect default value and incorrect operations ordering in NPU state machine#162
zjswhhh merged 4 commits into
sonic-net:masterfrom
BYGX-wcr:fix-state-machine

Conversation

@BYGX-wcr
Copy link
Copy Markdown
Contributor

What I did

  1. Set the default values of HaState to be Unspecified.
  2. Move the triggering of bulksync to be after the activation of Active role.

Why I did it

This is the correct way.

How I verified it

Details if related

BYGX-wcr added 2 commits May 12, 2026 22:47
Signed-off-by: BYGX-wcr <wcr@live.cn>
Copilot AI review requested due to automatic review settings May 12, 2026 22:52
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown

Copilot AI left a comment

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 the NPU-driven HA scope state machine in hamgrd to use a more appropriate default HA state when state is missing/unparseable, and to change the ordering of side effects when entering Active (notably when coming from Standalone) so bulk sync is triggered after activating the DPU role. It also updates the HA scope actor tests to match the new message ordering.

Changes:

  • Default missing/invalid NPU local/peer HaState values to Unspecified instead of Dead.
  • Reorder Active-entry side effects so DPU role activation happens before triggering bulk sync when transitioning from Standalone.
  • Update HA scope test expectations so BulkSyncUpdate(finished=true) is observed earlier relative to the DPU table update during pending activation approval.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
crates/hamgrd/src/actors/ha_scope/npu.rs Adjusts default HaState fallbacks and reorders Active transition side effects (bulk sync vs role activation).
crates/hamgrd/src/actors/ha_scope/mod.rs Updates test message ordering expectations to match the revised state machine behavior.

Comment thread crates/hamgrd/src/actors/ha_scope/npu.rs Outdated
Comment thread crates/hamgrd/src/actors/ha_scope/npu.rs
Signed-off-by: BYGX-wcr <wcr@live.cn>
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: BYGX-wcr <wcr@live.cn>
Copilot AI review requested due to automatic review settings May 12, 2026 23:32
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment on lines +1205 to +1209
// Bulk sync is triggered after Active role is activated
if *current_state == HaState::Standalone {
// If starting from Standalone, do bulk sync
let _ = self.add_bulk_sync_session(state);
}
@zjswhhh zjswhhh merged commit 838a059 into sonic-net:master May 13, 2026
8 checks passed
@BYGX-wcr BYGX-wcr deleted the fix-state-machine branch May 14, 2026 16:10
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