feat(proxmox): enhance VM resource tracking with auto-discovery and cached IPs

- Add VMResource wrapper type with cached IP addresses for efficient lookups
- Implement concurrent IP fetching during resource updates (limited concurrency)
- Add ReverseLookupResource for discovering VMs by IP, hostname, or alias
- Prioritize interfaces API over config for IP retrieval (offline container fallback)
- Enable routes to auto-discover Proxmox resources when no explicit config provided
- Fix configuration type from value to pointer slice for correct proxmox client retrievel
- Ensure Proxmox providers are initialized before route validation
This commit is contained in:
yusing
2026-01-25 02:25:07 +08:00
parent b4646b665f
commit cdd1353102
9 changed files with 145 additions and 21 deletions

View File

@@ -7,8 +7,6 @@ import (
"io"
"strings"
"time"
"github.com/luthermonson/go-proxmox"
)
// const statsScriptLocation = "/tmp/godoxy-stats.sh"
@@ -105,7 +103,7 @@ func (n *Node) LXCStats(ctx context.Context, vmid int, stream bool) (io.ReadClos
return pr, nil
}
func writeLXCStatsLine(resource *proxmox.ClusterResource, w io.Writer) error {
func writeLXCStatsLine(resource *VMResource, w io.Writer) error {
cpu := fmt.Sprintf("%.1f%%", resource.CPU*100)
memUsage := formatIECBytes(resource.Mem)