xcvrd: Remove SFP API object when SFP is removed#616
Merged
Conversation
When an SFP is physically removed from a port, the SFP API object should be removed from the sfp_obj_dict to prevent stale object references and ensure proper cleanup. This change ensures that when the SFP status is detected as removed, the corresponding SFP API object is properly deleted from the dictionary. Signed-off-by: Jianyue Wu <jianyuew@nvidia.com>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
keboliu
approved these changes
May 20, 2025
Junchao-Mellanox
approved these changes
May 22, 2025
Collaborator
|
@prgeor would you please review? |
prgeor
reviewed
May 28, 2025
Collaborator
|
@prgeor kindly reminder to review and merge. |
Contributor
Author
Hi @liat-grozovik I raised a meeting with @prgeor to discuss it in June 12nd 6pm PST. |
Collaborator
|
@prgeor would you please review and approve? |
mihirpat1
approved these changes
Jun 16, 2025
Collaborator
|
Cherry-pick PR to 202505: #627 |
Collaborator
|
Cherry-pick PR to msft-202412: Azure/sonic-platform-daemons.msft#22 |
Collaborator
|
Cherry-pick PR to msft-202405: Azure/sonic-platform-daemons.msft#68 |
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.
Depends on: sonic-net/sonic-platform-common#562
When an SFP is physically removed from a port, the SFP API object should be removed from the sfp_obj_dict to prevent stale object references and ensure proper cleanup. This change ensures that when the SFP status is detected as removed, the corresponding SFP API object is properly deleted from the dictionary.
Description
Add check for SFP_STATUS_REMOVED in SfpStateUpdateTask.
Remove SFP API object from sfp_obj_dict when SFP is removed.
Add unit test to verify SFP object removal functionality.
Motivation and Context
Make sure SFP API object is removed when SFP removed, so cmis cache can also be re-created.
How Has This Been Tested?
Tested with config reload.