[pve-devel] applied: [PATCH installer] get_device_desc: display disk size with 2 decimal places

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jan 26 12:03:22 CET 2022


On 25.01.22 14:04, Stoiko Ivanov wrote:
> instead of cutting it off by using int
> 
> especially relevant currently with 2 TB disks (people wonder why
> it's displayed as 1 TiB - and would be fine with 1.95TiB).
> 
> Reported in our community forum:
> https://forum.proxmox.com/threads/.103636/
> 
> Tested in a VM with a 100 GiB, 20GiB and 2TiB disk
> 
> Addtionally added the explicit return ath the end of the if branch,
> instead of relying on the last statement not moving.
> 
> Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
> ---
> Alternatively we could also use sprintf without decimal places for rounding
> (Math::Round is a debian package of it's own) - if people consider
> 20.00GiB to not look too pleasing

In general I really do not find that too pleasing, but here I think that first,
knowing the cheapness of HW vendors and TB vs TiB exact sizes won't happen often
and second, keeping it simple in the installer has quite some merit, so your
solutions works fine for me here.

> 
> Thanks to Dominik for insisting to see the code on this and suggesting
> to actually improve it :)
> 
>  proxinstall | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
>

applied, thanks!





More information about the pve-devel mailing list