]> git.proxmox.com Git - pve-container.git/commitdiff
fix #5414: use proper percentages in `pct df` master
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 25 Apr 2024 07:40:13 +0000 (09:40 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 Apr 2024 16:16:13 +0000 (18:16 +0200)
while some people write percentages as 0.XX , putting a % next to that is just
confusing. also, combined with the format modifier this would be rather lossy,
and also not match regular `df` output..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/PVE/CLI/pct.pm

index c48321d7a440230a5385fc3b3704bb06a2e4259d..4504b549826b3ff8dbcec60105e27c3b7a04b375 100755 (executable)
@@ -433,7 +433,7 @@ __PACKAGE__->register_method({
                    my $used = $format->($df->{used});
                    my $avail = $format->($df->{avail});
 
-                   my $pc = sprintf('%.1f', $df->{used}/$df->{total});
+                   my $pc = sprintf('%.1f', 100 * $df->{used} / $df->{total});
 
                    my $entry = [ $name, $mp->{volume}, $total, $used, $avail, $pc, $path ];
                    push @list, $entry;