Skip to content

Commit

Permalink
[psud] Make sure psu leds are set on the first run (sonic-net#125)
Browse files Browse the repository at this point in the history
Without this change, leds were only set when an event happened.
Given that power supplies are assumed present by default, leds would never be set to `green`.
Instead they would have been left in the state the platform initialization left them (e.g `off`)
  • Loading branch information
Staphylo authored Nov 25, 2020
1 parent f6e5e59 commit 12b3628
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sonic-psud/scripts/psud
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ class DaemonPsud(daemon_base.DaemonBase):
self.psu_status_dict = {}
self.fan_tbl = None
self.psu_chassis_info = None
self.first_run = True

# Signal handler
def signal_handler(self, sig, frame):
Expand Down Expand Up @@ -409,6 +410,8 @@ class DaemonPsud(daemon_base.DaemonBase):
self.update_psu_chassis_info(chassis_tbl)
self.update_master_led_color(chassis_tbl)

self.first_run = False

self.log_info("Stop daemon main loop")

# Delete all the information from DB and then exit
Expand Down Expand Up @@ -456,7 +459,7 @@ class DaemonPsud(daemon_base.DaemonBase):
self.psu_status_dict[index] = PsuStatus(self, psu)

psu_status = self.psu_status_dict[index]
set_led = False
set_led = self.first_run
if psu_status.set_presence(presence):
set_led = True
log_on_status_changed(self, psu_status.presence,
Expand Down

0 comments on commit 12b3628

Please sign in to comment.