From ff04e4fa324d7cafd317e3c50ed9a6850de4fe9d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 11 Sep 2024 09:12:14 -0400 Subject: [PATCH] Add blink support to Lenovo "IPMI" support Hop over to redfish to implement blink support in the identify LED. Change-Id: I9f304c3a135b7b00c6e20167940f86f5f375b5ad --- pyghmi/ipmi/command.py | 8 ++++++-- pyghmi/ipmi/oem/generic.py | 2 +- pyghmi/ipmi/oem/lenovo/handler.py | 4 +++- pyghmi/ipmi/oem/lenovo/imm.py | 8 ++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index 70c3012f..9684a824 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -551,7 +551,7 @@ class Command(object): return {'powerstate': self._get_power_state( bridge_request=bridge_request)} - def set_identify(self, on=True, duration=None): + def set_identify(self, on=True, duration=None, blink=False): """Request identify light Request the identify light to turn off, on for a duration, @@ -563,10 +563,14 @@ class Command(object): """ self.oem_init() try: - self._oem.set_identify(on, duration) + self._oem.set_identify(on, duration, blink) + return + except exc.BypassGenericBehavior: return except exc.UnsupportedFunctionality: pass + if blink: + raise exc.IpmiException('Blink not supported with generic IPMI') if duration is not None: duration = int(duration) if duration > 255: diff --git a/pyghmi/ipmi/oem/generic.py b/pyghmi/ipmi/oem/generic.py index e47cbb93..7b32738a 100644 --- a/pyghmi/ipmi/oem/generic.py +++ b/pyghmi/ipmi/oem/generic.py @@ -377,7 +377,7 @@ class OEMHandler(object): def list_media(self): raise exc.UnsupportedFunctionality() - def set_identify(self, on, duration): + def set_identify(self, on, duration, blink): """Provide an OEM override for set_identify Some systems may require an override for set identify. diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index f4feb63f..a07d7c53 100644 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -671,9 +671,11 @@ class OEMHandler(generic.OEMHandler): led_status_default) yield (name, {'status': status}) - def set_identify(self, on, duration): + def set_identify(self, on, duration, blink): if on and not duration and self.is_sd350: self.ipmicmd.xraw_command(netfn=0x3a, command=6, data=(1, 1)) + elif self.has_xcc: + self.immhandler.set_identify(on, duration, blink) else: raise pygexc.UnsupportedFunctionality() diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 05bad4c3..8ce6b87e 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -968,6 +968,14 @@ class XCCClient(IMMClient): fru['manufacturer'] = memi['memory_manufacturer'] break + def set_identify(self, on, duration, blink): + if blink: + self.grab_redfish_response_with_status( + '/redfish/v1/Systems/1', + {'IndicatorLED': 'Blinking'}, + method='PATCH') + raise pygexc.BypassGenericBehavior() + def get_description(self): dsc = self.wc.grab_json_response('/DeviceDescription.json') dsc = dsc[0]