Skip to content

Commit

Permalink
Fix issue: should not initialize led color in __init__ file as platfo…
Browse files Browse the repository at this point in the history
…rm API will be called by multiple daemons (sonic-net#7114)

- Why I did it
The existing Fan led and Psu led object initialize itself to green color in init method. However, there are multiple daemons calls sonic platform API and there could be a case that:

A PSU is removed from system
Reboot switch
psud detects that 1 PSU is missing and set PSU led to red
Other daemon just start up and call sonic platform API, the API set PSU led to green by call PsuLed.init
This PR is a partial fix for the issue. As we also need guarantee that the led is initialized with a correct value. I checked existing psud and thermalctld code. psud always initialize the PSU led color on boot up, thermalcltd need some changes to initialize led color on the first run

- How I did it
Remove the led color initialization code from FanLed.init and PsuLed.init

- How to verify it
Manual test
  • Loading branch information
Junchao-Mellanox authored and raphaelt-nvidia committed May 13, 2021
1 parent 2fd84b0 commit 177e56a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions platform/mellanox/mlnx-platform-api/sonic_platform/led.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ def __init__(self, index):
self._orange_led_path = os.path.join(Led.LED_PATH, "led_fan_orange")
self._led_cap_path = os.path.join(Led.LED_PATH, "led_fan_capability")

self.set_status(Led.STATUS_LED_COLOR_GREEN)

def get_green_led_path(self):
return self._green_led_path

Expand All @@ -234,8 +232,6 @@ def __init__(self, index):
self._red_led_path = os.path.join(Led.LED_PATH, "led_psu_red")
self._orange_led_path = os.path.join(Led.LED_PATH, "led_psu_orange")
self._led_cap_path = os.path.join(Led.LED_PATH, "led_psu_capability")

self.set_status(Led.STATUS_LED_COLOR_GREEN)

def get_green_led_path(self):
return self._green_led_path
Expand Down

0 comments on commit 177e56a

Please sign in to comment.