-
Notifications
You must be signed in to change notification settings - Fork 195
[SmartSwitch] Add graceful shutdown and startup handling in platform daemons #703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this 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 refactors module admin state management by introducing a new set_admin_state_gracefully method that encapsulates the pre-shutdown and post-startup hooks alongside the admin state change. The refactor simplifies the code by removing the ModuleTransitionFlagHelper class and duplicate logic for managing module state transitions.
- Replaces explicit
module_pre_shutdown,set_admin_state, andmodule_post_startupcalls with a singleset_admin_state_gracefullymethod - Removes the
ModuleTransitionFlagHelperclass and all transition flag tracking logic - Updates tests to reflect the new simplified API
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| sonic-chassisd/scripts/chassisd | Removes ModuleTransitionFlagHelper class, simplifies submit_callback and submit_dpu_callback methods to use set_admin_state_gracefully, removes duplicate initialization code |
| sonic-chassisd/tests/mock_platform.py | Adds mock implementation of set_admin_state_gracefully method |
| sonic-chassisd/tests/test_chassisd.py | Updates tests to mock set_admin_state_gracefully instead of individual pre/post hooks, adjusts assertions accordingly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@rameshraghupathy @gpunathilell could you please review this latest PR |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
HLD: https://github.com/sonic-net/SONiC/blob/master/doc/smart-switch/graceful-shutdown/graceful-shutdown.md
These changes build upon enhancements in
sonic-platform-daemons#667This PR introduces graceful shutdown and startup orchestration across SONiC platform daemons to ensure safe DPU and peripheral module transitions during reboot or administrative state changes.
Key updates include:
ModuleBaselifecycle methods (module_pre_shutdown,module_post_startup, andset_admin_state_gracefully) into platform daemons.CHASSIS_MODULE_TABLEviaSTATE_DBto synchronize transition state across processes.Motivation and Context
Platform daemons currently perform shutdown and startup independently, leading to:
This change introduces a unified graceful shutdown framework for SmartSwitch modules.
It ensures predictable module transitions, preserves hardware health, and supports orchestrated restarts without transient hardware errors.
How Has This Been Tested?
Testing performed on both DPU-enabled (SmartSwitch).
Functional validation
detaching/attaching) reflected inSTATE_DB.pcieddaemon logs confirm ordered detach before reboot and reattach after startup.Unit tests executed
Coverage includes:
Manual validation
Additional Information (Optional)