rocm_smi.py: Handle corrupted serial number

If the FRU has been corrupted, then the serial number will come in with
any manner of random bytes, which will cause decode() to fail
spectacularily. Check that the serial returned by the kernel is
alphanumeric, and print to the error log if not (then continue to the
next device).

Change-Id: If4f35b140b6089e02729b1490ed6b48d614a122a


[ROCm/rocm_smi_lib commit: 6b6e840337]
이 커밋은 다음에 포함됨:
Kent Russell가 2022-06-16 17:29:08 -04:00를 커밋했습니다
1 부모 f4cac3e4ef
커밋 140656e176
1 파일이 변경됨
+4
+4
파일 보기
@@ -2161,6 +2161,10 @@ def showSerialNumber(deviceList):
for device in deviceList:
sn = create_string_buffer(256)
ret = rocmsmi.rsmi_dev_serial_number_get(device, sn, 256)
if not str(sn).isalnum():
printErrLog(device, "FRU Serial Number contains non-alphanumeric characters. FRU is likely corrupted")
continue
if rsmi_ret_ok(ret, device) and sn.value.decode():
printLog(device, 'Serial Number', sn.value.decode())
else: