[action] [PR:608] [SmartSwitch] Enhance ModuleBase with graceful shutdown and startup transition handling #613
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
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-common#567This change introduces enhancements to the
ModuleBaseclass to support graceful shutdown and startup operations for DPU and other module types.It adds new methods and transition handling logic to ensure platform modules follow an ordered and coordinated shutdown/startup procedure, minimizing hardware inconsistencies and transient errors during reboot or DPU detachment.
Key changes include:
Added transition management APIs:
Introduced graceful lifecycle handlers:
_graceful_shutdown_handler()to wait for external transition completion usinggnoi_halt_in_progressfield with timeout handlingAdded helper functions for:
Motivation and Context
This enhancement is part of the SmartSwitch / DPU graceful shutdown/reboot and state management effort.
Currently,
ModuleBaselacks lifecycle orchestration methods for safe shutdown or startup of DPUs and peripheral modules.By adding transition-aware handling, the system can:
Avoid race conditions between platform daemons during reboot/shutdown
Ensure state transitions are reflected in Redis (CHASSIS_MODULE_TABLE)
Support controlled detach/reattach of PCIe devices and sensor configuration reloads
Enable PMON daemons to coordinate module-level transitions consistently
This work aligns with SONiC’s graceful reboot framework and the upcoming DPU lifecycle enhancements tracked internally.
How Has This Been Tested?
Testing performed on both SmartSwitch (DPU-enabled) and non-DPU platforms:
Additional Information (Optional)