Closed mlok-nokia closed 2 months ago
Change LGTM. Could you paste a syslog comparison before and after your change?
The context of log message is not changed. This PR is to stop logging the same message periodically when the Pusd Master Status is not changed. On the stablized system, we found that the same message is repeated thousand times (see below message). Also, the Pusd.set_status_master_led() has been trigged repeadedly to call the platform specified code to set the Master Led although the Status is not changed. 2024 Aug 2 03:33:14.778967 ixre-cpm-chassis11 NOTICE pmon#psud: message repeated 4420 times: [ PSU supplied power warning cleared: supplied power is back to normal.
@prgeor @judyjoseph Please cherry-pick this PR to 202405 branch
Cherry-pick PR to 202405: https://github.com/sonic-net/sonic-platform-daemons/pull/561
Description
In psud script, first_run is always true in PsuChassisInfo class. This causes the method update_master_status() always set the psu status_master_led and log the status change messages although the status is not changed. The same NOTICE message is repeated and never stop. Address this issue, added code to set the first_run to False after the first run. This initializes set_led to False before the calculation. So that it won't be True to trigger the set_status_maste_led() and log the same message while the status has NO change.
Motivation and Context
This PR fixes https://github.com/sonic-net/sonic-buildimage/issues/19780 and not set the LED to the same state or log the same message when there is NO change.
How Has This Been Tested?
Checking the syslog on the SUP. The following message will not be repeated if the status is not changed
Additional Information (Optional)