2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 11:48:33 +00:00

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
This commit is contained in:
Jarrod Johnson 2019-02-25 16:20:57 -05:00
parent 1575928d03
commit d36552df27

View File

@ -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()