MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / fetchStorageRows

Function fetchStorageRows

internal/cli/storage.go:158–182  ·  view source on GitHub ↗
(client *api.Client, nodeName string)

Source from the content-addressed store, hash-verified

156}
157
158func fetchStorageRows(client *api.Client, nodeName string) ([]storageListRow, error) {
159 storages, err := client.GetNodeStorages(nodeName)
160 if err != nil {
161 return nil, fmt.Errorf("failed to get storages for node %s: %w", nodeName, err)
162 }
163
164 rows := make([]storageListRow, 0, len(storages))
165 for _, s := range storages {
166 if s == nil {
167 continue
168 }
169
170 rows = append(rows, storageListRow{
171 Name: s.Name,
172 Node: nodeName,
173 Type: s.Plugintype,
174 Content: s.Content,
175 Used: s.Disk,
176 Total: s.MaxDisk,
177 Active: true, // GetNodeStorages already filters out inactive storages
178 })
179 }
180
181 return rows, nil
182}
183
184// ── storage show ──────────────────────────────────────────────────────────────
185

Callers 3

runStorageListFunction · 0.85
TestStorageListJSONShapeFunction · 0.85

Calls 1

GetNodeStoragesMethod · 0.80

Tested by 2

TestStorageListJSONShapeFunction · 0.68