refactor(region): replace 'ActualCapacity' with 'ActualCapacityUsed'

This commit is contained in:
rainzm
2020-09-23 15:25:30 +08:00
parent 9a7eae6e03
commit 56d24dfa99
3 changed files with 57 additions and 31 deletions

View File

@@ -916,8 +916,7 @@ type SGuestTemplate struct {
// 计费方式
BillingType string `json:"billing_type"`
// 其他配置信息
Content interface{} `json:"content"`
LastCheckTime time.Time `json:"last_check_time"`
Content interface{} `json:"content"`
}
// SGuestTemplateResourceBase is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestTemplateResourceBase.
@@ -926,6 +925,20 @@ type SGuestTemplateResourceBase struct {
GuestTemplateId string `json:"guest_template_id"`
}
// SGuestcdrom is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestcdrom.
type SGuestcdrom struct {
Id string `json:"id"`
// = Column(VARCHAR(36, charset='ascii'), primary_key=True)
ImageId string `json:"image_id"`
// Column(VARCHAR(36, charset='ascii'), nullable=True)
Name string `json:"name"`
// Column(VARCHAR(64, charset='ascii'), nullable=True)
Path string `json:"path"`
// Column(VARCHAR(256, charset='ascii'), nullable=True)
Size int64 `json:"size"`
UpdateVersion int `json:"update_version"`
}
// SGuestdisk is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SGuestdisk.
type SGuestdisk struct {
SGuestJointsBase
@@ -1045,11 +1058,10 @@ type SHost struct {
OvnVersion string `json:"ovn_version"`
IsBaremetal bool `json:"is_baremetal"`
// 是否处于维护状态
IsMaintenance bool `json:"is_maintenance"`
LastPingAt time.Time `json:"last_ping_at"`
EnableHealthCheck bool `json:"enable_health_check"`
ResourceType string `json:"resource_type"`
RealExternalId string `json:"real_external_id"`
IsMaintenance bool `json:"is_maintenance"`
EnableHealthCheck bool `json:"enable_health_check"`
ResourceType string `json:"resource_type"`
RealExternalId string `json:"real_external_id"`
// 是否为导入的宿主机
IsImport bool `json:"is_import"`
// 是否允许PXE启动
@@ -1305,12 +1317,9 @@ type SLoadbalancerAgentDeployment struct {
// SLoadbalancerAgentParams is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerAgentParams.
type SLoadbalancerAgentParams struct {
KeepalivedConfTmpl string `json:"keepalived_conf_tmpl"`
HaproxyConfTmpl string `json:"haproxy_conf_tmpl"`
TelegrafConfTmpl string `json:"telegraf_conf_tmpl"`
Vrrp SLoadbalancerAgentParamsVrrp `json:"vrrp"`
Haproxy SLoadbalancerAgentParamsHaproxy `json:"haproxy"`
Telegraf SLoadbalancerAgentParamsTelegraf `json:"telegraf"`
KeepalivedConfTmpl string `json:"keepalived_conf_tmpl"`
HaproxyConfTmpl string `json:"haproxy_conf_tmpl"`
TelegrafConfTmpl string `json:"telegraf_conf_tmpl"`
}
// SLoadbalancerAgentParamsHaproxy is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SLoadbalancerAgentParamsHaproxy.
@@ -1552,6 +1561,16 @@ type SManagedResourceBase struct {
ManagerId string `json:"manager_id"`
}
// SNatDEntry is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SNatDEntry.
type SNatDEntry struct {
SNatEntry
ExternalIP string `json:"external_ip"`
ExternalPort int `json:"external_port"`
InternalIP string `json:"internal_ip"`
InternalPort int `json:"internal_port"`
IpProtocol string `json:"ip_protocol"`
}
// SNatEntry is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SNatEntry.
type SNatEntry struct {
apis.SStatusInfrasResourceBase
@@ -1582,6 +1601,25 @@ type SNatgatewayResourceBase struct {
NatgatewayId string `json:"natgateway_id"`
}
// SNetInterface is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SNetInterface.
type SNetInterface struct {
Mac string `json:"mac"`
// Column(VARCHAR(36, charset='ascii'), primary_key=True)
BaremetalId string `json:"baremetal_id"`
// Column(VARCHAR(36, charset='ascii'), nullable=True)
WireId string `json:"wire_id"`
// Column(VARCHAR(36, charset='ascii'), nullable=True)
Rate int `json:"rate"`
// Column(Integer, nullable=True) # Mbps
NicType string `json:"nic_type"`
// Column(VARCHAR(36, charset='ascii'), nullable=True)
Index byte `json:"index"`
// Column(TINYINT, nullable=True)
LinkUp bool `json:"link_up"`
// Column(Boolean, nullable=True)
Mtu int16 `json:"mtu"`
}
// SNetwork is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SNetwork.
type SNetwork struct {
apis.SSharableVirtualResourceBase
@@ -1787,8 +1825,6 @@ type SScalingAlarm struct {
Value float64 `json:"value"`
// Real-time cumulate number
RealCumulate int `json:"real_cumulate"`
// Last trigger time
LastTriggerTime time.Time `json:"last_trigger_time"`
}
// SScalingGroup is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SScalingGroup.
@@ -1819,10 +1855,6 @@ type SScalingGroup struct {
HealthCheckGov int `json:"health_check_gov"`
LoadbalancerBackendPort int `json:"loadbalancer_backend_port"`
LoadbalancerBackendWeight int `json:"loadbalancer_backend_weight"`
// Time to allow scale
AllowScaleTime time.Time `json:"allow_scale_time"`
// NextCheckTime descripe the next time to check instance's health
NextCheckTime time.Time `json:"next_check_time"`
}
// SScalingGroupGuest is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SScalingGroupGuest.
@@ -2086,7 +2118,7 @@ type SStorage struct {
Capacity int64 `json:"capacity"`
// 实际容量大小单位Mb
// we always expect actual capacity great or equal than zero, otherwise something wrong
ActualCapacity int64 `json:"actual_capacity"`
ActualCapacityUsed int64 `json:"actual_capacity_used"`
// 预留容量大小
Reserved int64 `json:"reserved"`
// 存储类型
@@ -2164,13 +2196,7 @@ type STimer struct {
WeekDays byte `json:"week_days"`
// 0-31 0 is unlimited
MonthDays uint32 `json:"month_days"`
// StartTime represent the start time of this timer
StartTime time.Time `json:"start_time"`
// EndTime represent deadline of this timer
EndTime time.Time `json:"end_time"`
// NextTime represent the time timer should bell
NextTime time.Time `json:"next_time"`
IsExpired bool `json:"is_expired"`
IsExpired bool `json:"is_expired"`
}
// SVCenter is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SVCenter.

View File

@@ -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"`
// 存储类型
@@ -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
}

View File

@@ -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)
@@ -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()))