cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.65k stars 102 forks source link

Suggestion: display disk and size attributes with appropriate byte size units #820

Open williamtheaker opened 1 month ago

williamtheaker commented 1 month ago

It would be easier to understand disk usage if the disk and VM size exposed by commands like tart list and tart get were formatted with appropriate byte modifier.

Current:

tart list
Source Name           Disk Size State
local  sonoma-vanilla 51   17   stopped

Reporting the disk allocation size as 51GB would be slightly easier to grok and match the behavior of similar tools like Docker and Podman:

podman system df -v
Images space usage:

REPOSITORY                 TAG         IMAGE ID      CREATED     SIZE        SHARED SIZE  UNIQUE SIZE  CONTAINERS
docker.io/library/alpine   20240329    f8052e6d8143  6 weeks     8.986MB     0B           8.986MB      0
docker.io/library/busybox  latest      23d6e6de0b63  11 months   4.289MB     0B           4.289MB      0

Containers space usage:

CONTAINER ID  IMAGE       COMMAND     LOCAL VOLUMES  SIZE        CREATED     STATUS      NAMES

Local Volumes space usage:

VOLUME NAME                                                       LINKS       SIZE
bfdd925af2aa4ca248f1eb4d2f85a3248ccba91234c5bb5ead4696b50d0e04e4  0           452B

For example, the base size ofghcr.io/cirruslabs/debian:latest is 1.4GB, but Tart reports it as "1," which is less precise.

It might even be useful to rename Disk to something like "Allocated" since the current terminology can be kind of confusing.

fkorotkov commented 1 month ago

For backward compatibility we can persist the behaviour for json output and add GB for humans. Going from ints to floats is definitely a breaking change and only useful for small Linux images so IMO we can skip it.