Files
felhom-controller/controller/internal/system/info_other.go
T
admin 4989513a96 F1 (rework): source guest RAM cap from docker info; deploy guard uses committed memory
The cgroup-only approach was a no-op on the demo: the controller container's OWN
cgroup is unlimited (the 2GB cap is on the LXC ancestor, hidden), and /proc has no
lxcfs, so it kept reporting the host's 16GB. The Docker daemon runs IN the LXC, so
'docker info' MemTotal reports the guest's real cap (2048MB) — now the authoritative
source (cgroup limit preferred when present, e.g. non-nested). The deploy memory
guard now uses the controller's committed-app memory (sum of running mem requests)
for 'used' — accurate and cheap — instead of host /proc RSS (unobservable per guest;
would make the guard never/always fire). /api/system/info reports the guest cap as
total and committed memory as used. Tests: cgroup-limit path, docker-info fallback
(nested case), GuestMemTotalMB fallback (dockerMemTotalFn stub).
2026-06-14 10:18:22 +02:00

26 lines
665 B
Go

//go:build !linux
package system
import "fmt"
// GetInfo returns empty system info on non-Linux platforms.
func GetInfo(_ string, _ *CPUCollector) SystemInfo {
return SystemInfo{}
}
// GetTotalMemoryMB is not available on non-Linux platforms.
func GetTotalMemoryMB() (int, error) {
return 0, fmt.Errorf("/proc/meminfo not available on this platform")
}
// GetMemoryMB is not available on non-Linux platforms.
func GetMemoryMB() (totalMB, usedMB int, err error) {
return 0, 0, fmt.Errorf("/proc/meminfo not available on this platform")
}
// GuestMemTotalMB is not determinable on non-Linux platforms.
func GuestMemTotalMB() (int, bool) {
return 0, false
}