Improve Machines disk summaries

This commit is contained in:
rcourtman 2026-06-03 11:09:58 +01:00
parent f868487a68
commit eab62de61c
12 changed files with 289 additions and 10 deletions

View file

@ -103,6 +103,15 @@ var specialMountPrefixes = []string{
"/Library/Developer/CoreSimulator/Volumes/", // Xcode simulator runtime disk images
}
// specialMountpoints are exact mountpoints that represent platform plumbing
// rather than operator-managed capacity.
var specialMountpoints = map[string]bool{
"/boot/efi": true,
"/boot/firmware": true,
"/etc/pve": true,
"/var/run": true,
}
// containerOverlayPatterns detect container overlay filesystem paths from various
// container runtimes (Docker, Podman, LXC, EnhanceCP, etc.) that may not be in
// standard locations. These paths should be excluded from disk usage as they
@ -155,7 +164,7 @@ func ShouldSkipFilesystem(fsType, mountpoint string, totalBytes, usedBytes uint6
}
// Check specific special mountpoints
if mountpoint == "/boot/efi" || mountpoint == "/var/run" {
if specialMountpoints[mountpoint] {
reasons = append(reasons, "special-mountpoint")
}

View file

@ -175,6 +175,9 @@ func TestShouldSkipFilesystem(t *testing.T) {
{"/var/lib/docker", "ext4", "/var/lib/docker/overlay2", 1000000, 500000, true},
{"/snap prefix", "ext4", "/snap/core/12345", 1000000, 500000, true},
{"/boot/efi exact", "vfat", "/boot/efi", 512 * 1024 * 1024, 50 * 1024 * 1024, true},
{"/boot/firmware exact", "vfat", "/boot/firmware", 512 * 1024 * 1024, 50 * 1024 * 1024, true},
{"/boot regular filesystem - should NOT skip", "ext4", "/boot", 2 * 1024 * 1024 * 1024, 256 * 1024 * 1024, false},
{"Proxmox cluster config filesystem", "fuse", "/etc/pve", 128 * 1024 * 1024, 256 * 1024, true},
{"/var/lib/containers podman", "ext4", "/var/lib/containers/storage/overlay/abc123/merged", 1000000, 500000, true},
// Container overlay paths in non-standard locations (issue #790)