From d36552df27f0380d641d52e152b60068d0ecfbf7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 25 Feb 2019 16:20:57 -0500 Subject: [PATCH] Fix incorrect M.2 labelling Measure the M.2 status of a disk more directly, avoiding modifying the slotNo unless the disk is actually M.2 Change-Id: Ic8bd578654f586791f04d8f880842cc11e678ed5 --- pyghmi/ipmi/oem/lenovo/imm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 2f864ab8..8fbe4f7c 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -867,12 +867,14 @@ class XCCClient(IMMClient): yield self.get_disk_hardware(diskent) for diskent in adp.get('aimDisks', ()): if mode==0: - yield self.get_disk_firmware(diskent, 'M.2-') + yield self.get_disk_firmware(diskent) elif mode==1: - yield self.get_disk_hardware(diskent, 'M.2-') + yield self.get_disk_hardware(diskent) def get_disk_hardware(self, diskent, prefix=''): bdata = {} + if not prefix and diskent.get('location', '').startswith('M.2'): + prefix = 'M.2-' diskname = 'Disk {1}{0}'.format(diskent['slotNo'], prefix) bdata['Model'] = diskent['productName'].rstrip() bdata['Serial Number'] = diskent['serialNo'].rstrip() @@ -882,6 +884,8 @@ class XCCClient(IMMClient): def get_disk_firmware(self, diskent, prefix=''): bdata = {} + if not prefix and diskent.get('location', '').startswith('M.2'): + prefix = 'M.2-' diskname = 'Disk {1}{0}'.format(diskent['slotNo'], prefix) bdata['model'] = diskent[ 'productName'].rstrip()