From 520b7dbeca7c4ed0b40cf9ba8464c59bd10e9ccb Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 8 Jan 2019 17:22:57 -0500 Subject: [PATCH] Add M.2 Drive Firmware M.2 drive firmware is held in a different area in the API. Provide that data along non-M.2 drives. Change-Id: I94b85687b2f22bc45d6e37c9da855f7bbd426c2f --- pyghmi/ipmi/oem/lenovo/imm.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 23d62684..fd366fb5 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -853,19 +853,24 @@ class XCCClient(IMMClient): yield self.get_disk_firmware(diskent) elif mode==1: yield self.get_disk_hardware(diskent) + for diskent in adp.get('aimDisks', ()): + if mode==0: + yield self.get_disk_firmware(diskent, 'M.2-') + elif mode==1: + yield self.get_disk_hardware(diskent, 'M.2-') - def get_disk_hardware(self, diskent): + def get_disk_hardware(self, diskent, prefix=''): bdata = {} - diskname = 'Disk {0}'.format(diskent['slotNo']) + diskname = 'Disk {1}{0}'.format(diskent['slotNo'], prefix) bdata['Model'] = diskent['productName'].rstrip() bdata['Serial Number'] = diskent['serialNo'].rstrip() bdata['FRU Number'] = diskent['fruPartNo'].rstrip() bdata['Description'] = diskent['type'].rstrip() return (diskname, bdata) - def get_disk_firmware(self, diskent): + def get_disk_firmware(self, diskent, prefix=''): bdata = {} - diskname = 'Disk {0}'.format(diskent['slotNo']) + diskname = 'Disk {1}{0}'.format(diskent['slotNo'], prefix) bdata['model'] = diskent[ 'productName'].rstrip() bdata['version'] = diskent['fwVersion'] @@ -1190,7 +1195,7 @@ class XCCClient(IMMClient): psudata, util._monotonic_time()) if not psudata: return - for psu in psudata['items']: + for psu in psudata.get('items', ()): yield ('PSU {0}'.format(psu['slot']), { 'model': psu['model'],