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) <noreply@anthropic.com>
This commit is contained in:
@@ -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:<fs-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.
|
||||
@@ -104,6 +108,9 @@ func (s *Server) handleDisks(w http.ResponseWriter, r *http.Request, vmid int) {
|
||||
BackingDevice: t.BackingDevice, MountPath: t.MountPath, Class: t.ClassHint,
|
||||
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).
|
||||
|
||||
Reference in New Issue
Block a user