Fix issue: should not initialize led color in __init__ file as platform API will be called by multiple daemons (#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
This commit is contained in:
parent
4be9844728
commit
93a54450d3
@ -207,8 +207,6 @@ class FanLed(Led):
|
||||
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
|
||||
|
||||
@ -234,8 +232,6 @@ class PsuLed(Led):
|
||||
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
|
||||
|
Reference in New Issue
Block a user