ceph-volume: human_readable_size() refactor
This commit refactors the `human_readable_size()` function.
The current implementation has a couple of issues:
in a 'human readable' mindset, I would expect `human_readable_size(1024)` to
return '1.00 KB' instead of '1024.00 KB'.
```
In [1]: from ceph_volume.util.disk import human_readable_size
In [2]: human_readable_size(1024)
Out[2]: '1024.00 B'
In [3]: human_readable_size(1024*1024)
Out[3]: '1024.00 KB'
```
Also, it doesn't support PB unit:
```
In [4]: human_readable_size(1024*1024*1024*1024*1024)
Out[4]: '1024.00 TB'
In [5]: human_readable_size(1024*1024*1024*1024*1024*1024)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-31-
0859861661dc> in <module>
----> 1 human_readable_size(1024*1024*1024*1024*1024*1024)
~/GIT/ceph/src/ceph-volume/ceph_volume/util/disk.py in human_readable_size(size)
640 return "{size:.2f} {suffix}".format(
641 size=size,
--> 642 suffix=suffixes[suffix_index])
643
644
IndexError: list index out of range
```
This commit fixes this.
Fixes: https://tracker.ceph.com/issues/48492
Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>