Skip to content

Commit 1201dcf

Browse files
authored
List Tenant Total Size (#211)
1 parent 7bf25c8 commit 1201dcf

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

models/tenant_list.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

restapi/admin_tenants.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,19 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
269269

270270
var tenants []*models.TenantList
271271

272+
var totalSize int64
273+
272274
for _, minInst := range minTenants.Items {
273275

274276
var instanceCount int64
275277
var volumeCount int64
276278
for _, zone := range minInst.Spec.Zones {
277279
instanceCount = instanceCount + int64(zone.Servers)
278280
volumeCount = volumeCount + int64(zone.Servers*zone.VolumesPerServer)
281+
if zone.VolumeClaimTemplate != nil {
282+
zoneSize := int64(zone.VolumesPerServer) * int64(zone.Servers) * zone.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value()
283+
totalSize = totalSize + zoneSize
284+
}
279285
}
280286

281287
tenants = append(tenants, &models.TenantList{
@@ -286,6 +292,7 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
286292
VolumeCount: volumeCount,
287293
CurrentState: minInst.Status.CurrentState,
288294
Namespace: minInst.ObjectMeta.Namespace,
295+
TotalSize: totalSize,
289296
})
290297
}
291298

restapi/embedded_spec.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swagger.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ definitions:
17461746
type: integer
17471747
instance_count:
17481748
type: integer
1749-
volume_size:
1749+
total_size:
17501750
type: integer
17511751
volume_count:
17521752
type: integer

0 commit comments

Comments
 (0)