spiegel_podman/cmd/podman/system
Paul Holzinger c28401fe0a podman system df: fix percent calculation
The calculate the percentage we need floating point numbers. The current
code however casted the result of reclaimable/size to an int first.
Casting to an int in go will just discard the decimal points, thus the
result was either 0 or 1 so if multiplied by 100 it would show up as 0%
or 100%.

To fix this we have to multiply by 100 first before casting the result
to an int. Also add a check for div by zero which results in NaN and use
math.Round() to correctly round a number.

Ref #13516

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-03-30 15:36:05 -04:00
..
connection bump go module to version 4 2022-01-18 12:47:07 +01:00
connection.go bump go module to version 4 2022-01-18 12:47:07 +01:00
df.go podman system df: fix percent calculation 2022-03-30 15:36:05 -04:00
dial_stdio.go bump go module to version 4 2022-01-18 12:47:07 +01:00
events.go bump go module to version 4 2022-01-18 12:47:07 +01:00
info.go bump go module to version 4 2022-01-18 12:47:07 +01:00
migrate.go bump go module to version 4 2022-01-18 12:47:07 +01:00
prune.go bump go module to version 4 2022-01-18 12:47:07 +01:00
renumber.go bump go module to version 4 2022-01-18 12:47:07 +01:00
reset.go system prune: remove all networks 2022-02-03 15:01:29 -05:00
service.go bump go module to version 4 2022-01-18 12:47:07 +01:00
service_abi.go bump go module to version 4 2022-01-18 12:47:07 +01:00
system.go bump go module to version 4 2022-01-18 12:47:07 +01:00
unshare.go bump go module to version 4 2022-01-18 12:47:07 +01:00
version.go fix empty newline in version output 2022-03-30 14:03:45 -04:00