mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): add actual capacity used usage (#21574)
This commit is contained in:
@@ -1288,6 +1288,7 @@ func (manager *SStorageManager) totalCapacityQ(
|
||||
storages.Field("capacity"),
|
||||
storages.Field("reserved"),
|
||||
storages.Field("cmtbound"),
|
||||
storages.Field("actual_capacity_used"),
|
||||
storages.Field("storage_type"),
|
||||
storages.Field("medium_type"),
|
||||
stmt.Field("used_capacity"),
|
||||
@@ -1311,6 +1312,7 @@ type StorageStat struct {
|
||||
Capacity int
|
||||
Reserved int
|
||||
Cmtbound float32
|
||||
ActualCapacityUsed int64
|
||||
StorageType string
|
||||
MediumType string
|
||||
UsedCapacity int
|
||||
@@ -1324,16 +1326,17 @@ type StorageStat struct {
|
||||
}
|
||||
|
||||
type StoragesCapacityStat struct {
|
||||
Capacity int64
|
||||
CapacityVirtual float64
|
||||
CapacityUsed int64
|
||||
CountUsed int
|
||||
CapacityUnready int64
|
||||
CountUnready int
|
||||
AttachedCapacity int64
|
||||
CountAttached int
|
||||
DetachedCapacity int64
|
||||
CountDetached int
|
||||
Capacity int64
|
||||
CapacityVirtual float64
|
||||
CapacityUsed int64
|
||||
ActualCapacityUsed int64
|
||||
CountUsed int
|
||||
CapacityUnready int64
|
||||
CountUnready int
|
||||
AttachedCapacity int64
|
||||
CountAttached int
|
||||
DetachedCapacity int64
|
||||
CountDetached int
|
||||
|
||||
MediumeCapacity map[string]int64
|
||||
StorageTypeCapacity map[string]int64
|
||||
@@ -1355,6 +1358,7 @@ func (manager *SStorageManager) calculateCapacity(q *sqlchemy.SQuery) StoragesCa
|
||||
tCapa int64 = 0
|
||||
tVCapa float64 = 0
|
||||
tUsed int64 = 0
|
||||
aUsed int64 = 0
|
||||
cUsed int = 0
|
||||
tFailed int64 = 0
|
||||
cFailed int = 0
|
||||
@@ -1397,6 +1401,7 @@ func (manager *SStorageManager) calculateCapacity(q *sqlchemy.SQuery) StoragesCa
|
||||
tVCapa += float64(stat.Capacity-stat.Reserved) * float64(stat.Cmtbound)
|
||||
mCapaUsed, sCapaUsed = add(mCapaUsed, sCapaUsed, stat.MediumType, stat.StorageType, int64(stat.UsedCapacity))
|
||||
tUsed += int64(stat.UsedCapacity)
|
||||
aUsed += int64(stat.ActualCapacityUsed)
|
||||
cUsed += stat.UsedCount
|
||||
tFailed += int64(stat.FailedCapacity)
|
||||
mFailed, sFailed = add(mFailed, sFailed, stat.MediumType, stat.StorageType, int64(stat.FailedCapacity))
|
||||
@@ -1414,6 +1419,7 @@ func (manager *SStorageManager) calculateCapacity(q *sqlchemy.SQuery) StoragesCa
|
||||
StorageTypeCapacity: sCapa,
|
||||
CapacityVirtual: tVCapa,
|
||||
CapacityUsed: tUsed,
|
||||
ActualCapacityUsed: aUsed,
|
||||
MediumeCapacityUsed: mCapaUsed,
|
||||
StorageTypeCapacityUsed: sCapaUsed,
|
||||
CountUsed: cUsed,
|
||||
|
||||
@@ -687,6 +687,7 @@ func StorageUsage(
|
||||
count[fmt.Sprintf("%s.medium_type.%s", sPrefix, m)] = capa
|
||||
}
|
||||
count[fmt.Sprintf("%s.virtual", sPrefix)] = result.CapacityVirtual
|
||||
count[fmt.Sprintf("%s.actual_capacity_used", sPrefix)] = result.ActualCapacityUsed
|
||||
count[fmt.Sprintf("%s.owner", dPrefix)] = result.CapacityUsed
|
||||
count[fmt.Sprintf("%s.count.owner", dPrefix)] = result.CountUsed
|
||||
count[fmt.Sprintf("%s.unready.owner", dPrefix)] = result.CapacityUnready
|
||||
|
||||
Reference in New Issue
Block a user