The single-letter suffixes are ambiguous and especially in the context
of disks, the powers of ten are usually used. Proxmox VE uses
multiples of 1024 however. By adapting format_size() to use the verbose
suffixes all newly written or re-written sizes will use the more
verbose/explicit suffix.

Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---
 src/PVE/JSONSchema.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
index e7c366f..e1f6334 100644
--- a/src/PVE/JSONSchema.pm
+++ b/src/PVE/JSONSchema.pm
@@ -1015,15 +1015,15 @@ sub format_size {
     return $size if $kb * 1024 != $size;
 
     my $mb = int($kb / 1024);
-    return "${kb}K" if $mb * 1024 != $kb;
+    return "${kb}KiB" if $mb * 1024 != $kb;
 
     my $gb = int($mb / 1024);
-    return "${mb}M" if $gb * 1024 != $mb;
+    return "${mb}MiB" if $gb * 1024 != $mb;
 
     my $tb = int($gb / 1024);
-    return "${gb}G" if $tb * 1024 != $gb;
+    return "${gb}GiB" if $tb * 1024 != $gb;
 
-    return "${tb}T";
+    return "${tb}TiB";
 }
 
 sub parse_boolean {
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to