sonic-net / sonic-platform-daemons

Platform module daemons for SONiC
Other
25 stars 159 forks source link

[action] [PR:424] Combine psu presence/status update with data update (#424) #447

Closed mssonicbld closed 8 months ago

mssonicbld commented 8 months ago

When sysfs is simultaneously changing while psud updating, some data could be outdated immediately once read, so delay the psu presence and status updating to the final step, insure we get the latest info.

Description PSU Model Serial HW Rev Voltage (V) Current (A) Power (W) Status LED PSU 1 N/A N/A N/A 12.00 N/A N/A OK green PSU 2 XXXXXXX XXXXXXXX A3 12.01 16.25 194.75 OK green

The status should be NOTOK as the psu had been turned off and other fields had became N/A as expected.

Motivation and Context The failure flow are showing below:

psu_db_update(self.psu_tbl, self.num_psus) // here we read and update the old data of psu status. 
self.update_psu_data() // now psu status had been changed to NOTOK, but we won’t read it until next psu update cycle , other filed becomes N/A as expected.

How Has This Been Tested? platform_tests/api/test_psu.py

Signed-off-by: Yuanzhe, Liu yualiu@nvidia.com

mssonicbld commented 8 months ago

Original PR: https://github.com/sonic-net/sonic-platform-daemons/pull/424