From 4a2e1cc26d3881d8fd3298310fba65401c943952 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Mon, 24 Feb 2025 17:32:06 +0800 Subject: [PATCH] fix: remove default values from cmtbound columns (#22157) Co-authored-by: Qiu Jian --- pkg/compute/models/hosts.go | 4 ++-- pkg/compute/models/storages.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index 56aae952a5..58304f005c 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -137,7 +137,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" create:"domain_optional"` + CpuCmtbound float32 `nullable:"true" list:"domain" create:"domain_optional"` // CPUMicrocode CpuMicrocode string `width:"64" charset:"ascii" nullable:"true" get:"domain" update:"domain" create:"domain_optional"` // CPU架构 @@ -148,7 +148,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" create:"domain_optional"` + MemCmtbound float32 `nullable:"true" list:"domain" create:"domain_optional"` // 页大小 PageSizeKB int `nullable:"false" default:"4" list:"domain" update:"domain" create:"domain_optional"` EnableNumaAllocate bool `nullable:"true" default:"false" list:"domain" update:"domain" create:"domain_optional"` diff --git a/pkg/compute/models/storages.go b/pkg/compute/models/storages.go index 98b1e6ea36..735f16bfc3 100644 --- a/pkg/compute/models/storages.go +++ b/pkg/compute/models/storages.go @@ -88,7 +88,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"` + Cmtbound float32 `nullable:"true" list:"domain"` // 存储配置信息 StorageConf jsonutils.JSONObject `nullable:"true" get:"domain" list:"domain" update:"domain"` @@ -734,9 +734,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 }