2
0
mirror of https://opendev.org/x/pyghmi synced 2026-04-01 15:53:32 +00:00

Fix str_to_size logic.

Change-Id: I133d1ff24883619a2125320c969b4aabca24e683
This commit is contained in:
Vlad Spoiala
2022-02-09 18:12:17 +02:00
parent dba5fba00f
commit 8a1649df1a

View File

@@ -102,16 +102,16 @@ def fixup_str(propstr):
def str_to_size(sizestr):
if 'GB' in sizestr:
sizestr = sizestr.replace('GB', '')
sizestr = int(float(sizestr * 1024))
sizestr = int(float(sizestr) * 1024)
elif 'GiB' in sizestr:
sizestr = sizestr.replace('GiB', '')
sizestr = int(float(sizestr * 1024))
sizestr = int(float(sizestr) * 1024)
elif 'TB' in sizestr:
sizestr = sizestr.replace('TB', '')
sizestr = int(float(sizestr * 1000 * 1000))
sizestr = int(float(sizestr) * 1000 * 1000)
elif 'TiB' in sizestr:
sizestr = sizestr.replace('TiB', '')
sizestr = int(float(sizestr * 1024 * 1024))
sizestr = int(float(sizestr) * 1024 * 1024)
return sizestr