From 832b73e6e8dc417cd6880f782aa9b1f0aea306b1 Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Thu, 11 Jun 2026 21:30:38 +0200 Subject: [PATCH] agent v0.23.0: expose per-drive capacity (total/used/fraction) in GET /disks for the controller capacity bar Co-Authored-By: Claude Opus 4.8 (1M context) --- internal/localapi/disks.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/localapi/disks.go b/internal/localapi/disks.go index 4dfb0ef..03fc219 100644 --- a/internal/localapi/disks.go +++ b/internal/localapi/disks.go @@ -77,6 +77,10 @@ type DiskInfo struct { Role string `json:"role"` DataBearing bool `json:"data_bearing"` // agent device-inspection verdict (UI hint) DataReason string `json:"data_reason,omitempty"` + // Capacity (from the agent's storage view) — for the controller's capacity bar. 0 when unknown. + TotalBytes int64 `json:"total_bytes"` + UsedBytes int64 `json:"used_bytes"` + UsedFraction float64 `json:"used_fraction"` // DurableID is the target's stable identity (e.g. "uuid:" for usb/local-dir). The // controller strips the "uuid:" prefix to get the fs UUID it passes to POST /disks/assign — // the only way the (de-privileged) controller can learn the mount key it cannot read itself. @@ -102,8 +106,11 @@ func (s *Server) handleDisks(w http.ResponseWriter, r *http.Request, vmid int) { di := DiskInfo{ Name: t.Name, Type: t.Type, State: t.State, BackingDevice: t.BackingDevice, MountPath: t.MountPath, Class: t.ClassHint, - DurableID: t.DurableID, - Role: string(storage.RoleForStorage(t.Type, t.BackingDevice, sysDisks, sysKnown)), + DurableID: t.DurableID, + Role: string(storage.RoleForStorage(t.Type, t.BackingDevice, sysDisks, sysKnown)), + TotalBytes: t.TotalBytes, + UsedBytes: t.UsedBytes, + UsedFraction: t.UsedFraction, } // Inspect the backing device for the UI's data-bearing hint (the authoritative check // is re-run at format time on the actual device).