Skip to content

Commit

Permalink
fix: remove default values from cmtbound columns (#22159)
Browse files Browse the repository at this point in the history
Co-authored-by: Qiu Jian <[email protected]>
  • Loading branch information
swordqiu and Qiu Jian authored Feb 24, 2025
1 parent 9065d46 commit 3c0d842
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/compute/models/hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type SHost struct {
// 预留CPU大小
CpuReserved int `nullable:"true" default:"0" list:"domain" update:"domain" create:"domain_optional"`
// CPU超分比
CpuCmtbound float32 `nullable:"true" default:"8" list:"domain" update:"domain" create:"domain_optional"`
CpuCmtbound float32 `nullable:"true" list:"domain" update:"domain" create:"domain_optional"`
// CPUMicrocode
CpuMicrocode string `width:"64" charset:"ascii" nullable:"true" get:"domain" update:"domain" create:"domain_optional"`
// CPU架构
Expand All @@ -145,7 +145,7 @@ type SHost struct {
// 预留内存大小
MemReserved int `nullable:"true" default:"0" list:"domain" update:"domain" create:"domain_optional"`
// 内存超分比
MemCmtbound float32 `nullable:"true" default:"1" list:"domain" update:"domain" create:"domain_optional"`
MemCmtbound float32 `nullable:"true" list:"domain" update:"domain" create:"domain_optional"`

// 存储大小,单位Mb
StorageSize int `nullable:"true" list:"domain" update:"domain" create:"domain_optional"`
Expand Down
8 changes: 4 additions & 4 deletions pkg/compute/models/storages.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ type SStorage struct {
// example: ssd
MediumType string `width:"32" charset:"ascii" nullable:"false" list:"user" update:"domain" create:"domain_required"`
// 超售比
Cmtbound float32 `nullable:"true" default:"1" list:"domain" update:"domain"`
Cmtbound float32 `nullable:"true" list:"domain" update:"domain"`
// 存储配置信息
StorageConf jsonutils.JSONObject `nullable:"true" get:"domain" list:"domain" update:"domain"`

Expand Down Expand Up @@ -676,9 +676,9 @@ func (self *SStorage) GetUsedCapacity(isReady tristate.TriState) int64 {
}
}

func (self *SStorage) GetOvercommitBound() float32 {
if self.Cmtbound > 0 {
return self.Cmtbound
func (storage *SStorage) GetOvercommitBound() float32 {
if storage.Cmtbound > 0 {
return storage.Cmtbound
} else {
return options.Options.DefaultStorageOvercommitBound
}
Expand Down

0 comments on commit 3c0d842

Please sign in to comment.