Add SMM2 VPD to configuration for SMM

Change-Id: Ia7a4b804a645a36c212404f3429c42b26938210e
This commit is contained in:
Jarrod Johnson 2022-06-07 11:06:05 -04:00
parent 5c32d4d11d
commit a9258c1e9b
3 changed files with 39 additions and 3 deletions

View File

@ -568,6 +568,30 @@ class SMMClient(object):
}
except Exception:
pass
try:
chassisvpd = self.ipmicmd.xraw_command(0x32, 0xb0, data=(5, 0))
chassisvpd = bytearray(chassisvpd['data'][2:])
chassisvpd = bytes(chassisvpd).strip()
if not isinstance(chassisvpd, str):
chassisvpd = chassisvpd.decode('utf8')
settings['chassis_model'] = {
'value': chassisvpd,
'help': ('Configure the chassis model number')
}
except Exception:
pass
try:
chassisvpd = self.ipmicmd.xraw_command(0x32, 0xb0, data=(5, 1))
chassisvpd = bytearray(chassisvpd['data'][2:])
chassisvpd = bytes(chassisvpd).strip()
if not isinstance(chassisvpd, str):
chassisvpd = chassisvpd.decode('utf8')
settings['chassis_serial'] = {
'value': chassisvpd,
'help': ('Configure the chassis serial number')
}
except Exception:
pass
return settings
def set_bay_cap(self, baynum, val):
@ -589,6 +613,8 @@ class SMMClient(object):
powercfg = [None, None]
sendhost = None
sendvci = None
newserial = None
newmodel = None
for key in changeset:
if not key:
raise pygexc.InvalidParameterValue('Empty key is invalid')
@ -620,6 +646,10 @@ class SMMClient(object):
sendvci = stringtoboolean(
changeset[key]['value'],
'dhcp_sends_vendor_class_identifier')
if fnmatch.fnmatch('chassis_serial', key.lower()):
newserial = changeset[key]['value']
if fnmatch.fnmatch('chassis_model', key.lower()):
newmodel = changeset[key]['value']
# Variant low 8 bits is the height in U of chassis, so double that
# to get maxbays
numbays = (self.smm_variant & 0x0f) << 1
@ -672,6 +702,14 @@ class SMMClient(object):
if sendvci is not None:
sendvci = 1 if sendvci else 0
self.ipmicmd.xraw_command(0xc, 1, data=[1, 0xc6, sendvci])
if newserial:
newserial = newserial.ljust(10).encode('utf8')
cmdata = b'\x05\x01' + newserial
self.ipmicmd.xraw_command(0x32, 0xaf, data=cmdata)
if newmodel:
newmodel = newmodel.ljust(10).encode('utf8')
cmdata = b'\x05\x00' + newmodel
self.ipmicmd.xraw_command(0x32, 0xaf, data=cmdata)
def set_user_priv(self, uid, priv):
if priv.lower() == 'administrator':

View File

@ -1,5 +1,5 @@
coverage>=4.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0
python-subunit>=1.0.0
stestr>=2.0.0,!=2.3.0,!=3.0.0 # Apache-2.0

View File

@ -1,6 +1,4 @@
- project:
templates:
- check-requirements
- openstack-cover-jobs
- openstack-python3-yoga-jobs
- publish-openstack-docs-pti