Skip to content

humanBytes: Fix mis-conversion of GiB to bytes and MiB to bytes

Overview

When humanNumber calls humanBytes it converts the native unit of the data type passed into it into raw byte counts so that humanBytes can perform the appropriate conversion to a displayable format.

Unfortunately when that function was introduced in e1eb0551 it was overlooked that the conversion was performed wrongly, converting what would be a gigabyte value instead of a gigibyte value.

In this patch we're replacing the conversion factor so that input values in gigibytes or mebibytes will properly convert through humanBytes into the expected values.

Furthermore we're extending the rounding to at most one decimal digit when displaying the storage total because previously, with zero digits, it was rounding values such as 1500 MiB to 2 TB.

How to Test

Open Exosphere to the Volume page and examine the values reported for each volume and also for the total limits. These correspond to the /volumes/detail and /limits API calls.

Ensure that the reported values correspond to the same values presented in the API call response and, additionally, to the values reported in Jetstream Horizon.

Screenshots

Screenshot_2022-11-30_at_3.53.04_PM

Screenshot_2022-11-30_at_3.52.18_PM

Closes #865 (closed)

Merge request reports