Skip to content

Commit

Permalink
refactor(region): replace 'ActualCapacity' with 'ActualCapacityUsed'
Browse files Browse the repository at this point in the history
  • Loading branch information
rainzm committed Sep 25, 2020
1 parent 7e362ca commit e0c94da
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 31 deletions.
80 changes: 53 additions & 27 deletions pkg/apis/compute/zz_generated.model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/compute/models/storages.go
Expand Up @@ -74,7 +74,7 @@ type SStorage struct {
Capacity int64 `nullable:"false" list:"domain" update:"domain" create:"domain_required"`
// 实际容量大小,单位Mb
// we always expect actual capacity great or equal than zero, otherwise something wrong
ActualCapacity int64 `nullable:"true" list:"domain" update:"domain" create:"domain_optional"`
ActualCapacityUsed int64 `nullable:"true" list:"domain" update:"domain" create:"domain_optional"`
// 预留容量大小
Reserved int64 `nullable:"true" default:"0" list:"domain" update:"domain"`
// 存储类型
Expand Down Expand Up @@ -412,7 +412,7 @@ func (self *SStorage) getStorageCapacity() SStorageCapacity {
capa.Used = self.GetUsedCapacity(tristate.True)
capa.Wasted = self.GetUsedCapacity(tristate.False)
capa.VCapacity = int64(float32(self.GetCapacity()) * self.GetOvercommitBound())
capa.ActualUsed = self.ActualCapacity
capa.ActualUsed = self.ActualCapacityUsed

return capa
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/hostman/storageman/storage_local.go
Expand Up @@ -87,7 +87,7 @@ func (s *SLocalStorage) GetComposedName() string {

func (s *SLocalStorage) SyncStorageSize() error {
content := jsonutils.NewDict()
content.Set("actual_capacity", jsonutils.NewInt(int64(s.GetUsedSizeMb())))
content.Set("actual_capacity_used", jsonutils.NewInt(int64(s.GetUsedSizeMb())))
_, err := modules.Storages.Put(
hostutils.GetComputeSession(context.Background()),
s.StorageId, content)
Expand All @@ -98,7 +98,7 @@ func (s *SLocalStorage) SyncStorageInfo() (jsonutils.JSONObject, error) {
content := jsonutils.NewDict()
content.Set("name", jsonutils.NewString(s.GetName(s.GetComposedName)))
content.Set("capacity", jsonutils.NewInt(int64(s.GetAvailSizeMb())))
content.Set("actual_capacity", jsonutils.NewInt(int64(s.GetUsedSizeMb())))
content.Set("actual_capacity_used", jsonutils.NewInt(int64(s.GetUsedSizeMb())))
content.Set("storage_type", jsonutils.NewString(s.StorageType()))
content.Set("medium_type", jsonutils.NewString(s.GetMediumType()))
content.Set("zone", jsonutils.NewString(s.GetZoneName()))
Expand Down

0 comments on commit e0c94da

Please sign in to comment.