From 1f1a2cac16a93fe29b0553d94fa321c5eb0451d2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 7 Jun 2021 15:16:07 -0400 Subject: [PATCH] Some firmware presents GiB instead of GB Understand GiB and GB as the same. Change-Id: I64121e026010dfd65785fe1ff43276d0f1f49c5b --- pyghmi/ipmi/oem/lenovo/imm.py | 6 ++++-- pyghmi/redfish/oem/lenovo/xcc.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/imm.py b/pyghmi/ipmi/oem/lenovo/imm.py index 4b85608d..1785eacd 100644 --- a/pyghmi/ipmi/oem/lenovo/imm.py +++ b/pyghmi/ipmi/oem/lenovo/imm.py @@ -1473,9 +1473,11 @@ class XCCClient(IMMClient): spares.append(diskinfo) else: disks.append(diskinfo) - totalsize = pool['totalCapacityStr'].replace('GB', '') + totalsize = pool['totalCapacityStr'].replace( + 'GB', '').replace('GiB', '') totalsize = int(float(totalsize) * 1024) - freesize = pool['freeCapacityStr'].replace('GB', '') + freesize = pool['freeCapacityStr'].replace( + 'GB', '').replace('GiB', '') freesize = int(float(freesize) * 1024) pools.append(storage.Array( disks=disks, raid=pool['rdlvlstr'], volumes=volumes, diff --git a/pyghmi/redfish/oem/lenovo/xcc.py b/pyghmi/redfish/oem/lenovo/xcc.py index ccb15321..9eaa4f88 100644 --- a/pyghmi/redfish/oem/lenovo/xcc.py +++ b/pyghmi/redfish/oem/lenovo/xcc.py @@ -308,9 +308,11 @@ class OEMHandler(generic.OEMHandler): spares.append(diskinfo) else: disks.append(diskinfo) - totalsize = pool['totalCapacityStr'].replace('GB', '') + totalsize = pool['totalCapacityStr'].replace( + 'GB', '').replace('GiB', '') totalsize = int(float(totalsize) * 1024) - freesize = pool['freeCapacityStr'].replace('GB', '') + freesize = pool['freeCapacityStr'].replace( + 'GB', '').replace('GiB', '') freesize = int(float(freesize) * 1024) pools.append(storage.Array( disks=disks, raid=pool['rdlvlstr'], volumes=volumes,