List Tenant Total Size (#211)
This commit is contained in:
@@ -47,12 +47,12 @@ type TenantList struct {
|
||||
// namespace
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
|
||||
// total size
|
||||
TotalSize int64 `json:"total_size,omitempty"`
|
||||
|
||||
// volume count
|
||||
VolumeCount int64 `json:"volume_count,omitempty"`
|
||||
|
||||
// volume size
|
||||
VolumeSize int64 `json:"volume_size,omitempty"`
|
||||
|
||||
// zone count
|
||||
ZoneCount int64 `json:"zone_count,omitempty"`
|
||||
}
|
||||
|
||||
@@ -269,6 +269,8 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
|
||||
|
||||
var tenants []*models.TenantList
|
||||
|
||||
var totalSize int64
|
||||
|
||||
for _, minInst := range minTenants.Items {
|
||||
|
||||
var instanceCount int64
|
||||
@@ -276,6 +278,10 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
|
||||
for _, zone := range minInst.Spec.Zones {
|
||||
instanceCount = instanceCount + int64(zone.Servers)
|
||||
volumeCount = volumeCount + int64(zone.Servers*zone.VolumesPerServer)
|
||||
if zone.VolumeClaimTemplate != nil {
|
||||
zoneSize := int64(zone.VolumesPerServer) * int64(zone.Servers) * zone.VolumeClaimTemplate.Spec.Resources.Requests.Storage().Value()
|
||||
totalSize = totalSize + zoneSize
|
||||
}
|
||||
}
|
||||
|
||||
tenants = append(tenants, &models.TenantList{
|
||||
@@ -286,6 +292,7 @@ func listTenants(ctx context.Context, operatorClient OperatorClient, namespace s
|
||||
VolumeCount: volumeCount,
|
||||
CurrentState: minInst.Status.CurrentState,
|
||||
Namespace: minInst.ObjectMeta.Namespace,
|
||||
TotalSize: totalSize,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2631,10 +2631,10 @@ func init() {
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
},
|
||||
"volume_count": {
|
||||
"total_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"volume_size": {
|
||||
"volume_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zone_count": {
|
||||
@@ -5390,10 +5390,10 @@ func init() {
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
},
|
||||
"volume_count": {
|
||||
"total_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"volume_size": {
|
||||
"volume_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"zone_count": {
|
||||
|
||||
@@ -1746,7 +1746,7 @@ definitions:
|
||||
type: integer
|
||||
instance_count:
|
||||
type: integer
|
||||
volume_size:
|
||||
total_size:
|
||||
type: integer
|
||||
volume_count:
|
||||
type: integer
|
||||
|
||||
Reference in New Issue
Block a user