chassisd: Fix crash on exit on linecard#347
Merged
gechiang merged 1 commit intosonic-net:masterfrom Mar 23, 2023
Merged
Conversation
wenyiz2021
reviewed
Mar 16, 2023
wenyiz2021
left a comment
There was a problem hiding this comment.
@patrickmacarthur thanks for the fix, can you please add a UT to cover this? PR is blocked by coverage check
Contributor
|
@gechiang for viz. |
abdosi
previously approved these changes
Mar 17, 2023
Contributor
|
@patrickmacarthur can you also include a test to cover the one line change you fixed? This is required before the change can be merged. |
Contributor
We try to access config_manager, even if it wasn't set. Unconditionally set it to resolve the issue.
f09fd52 to
a62426e
Compare
Contributor
Author
|
/azpw run Azure.sonic-platform-daemons |
Collaborator
|
/AzurePipelines run Azure.sonic-platform-daemons |
|
Azure Pipelines successfully started running 1 pipeline(s). |
yxieca
pushed a commit
that referenced
this pull request
Mar 24, 2023
We try to access config_manager, even if it wasn't set. Unconditionally set it to resolve the issue.
|
@patrickmacarthur cherry pick to 202211 with conflict, could you submit PR separately for 202211? |
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.
Description
Set the
config_managervariable toNoneif we are running on a linecard and thus don't need to set up the config manager.Motivation and Context
During cleanup, the chassid service tries to clean up the
config_manager, but theconfig_managervariable is only ever initialized if we are on the supervisor. Thus, checking if it isNoneis insufficient because this results in anUnboundLocalErrorthat prevents the cleanup from succeeding on a linecard.How Has This Been Tested?
This was tested via the sonic-mgmt
platform_tests/daemon/test_chassisd.pytest. Without this change, thetest_pmon_chassisd_stop_and_start_statustest would fail and a traceback would be present in syslog. The test passes with this patch applied.Additional Information (Optional)