mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #895 in YUNIONIO/onecloud from ~LIZEXI/onecloud:feature/lzx-sched-filter-zone-status to release/2.5.0
* commit 'c0102d0a32bfe2c0307c3cf4d71e0aa9eadfbe66': scheduler: host 的 zone status 为 enable 时才能调度
This commit is contained in:
@@ -50,6 +50,10 @@ func (p *StatusPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []core
|
||||
h.Exclude2("enable_status", curEnableStatus, true)
|
||||
}
|
||||
|
||||
if hc.Zone.Status != ExpectedEnableStatus {
|
||||
h.Exclude2("zone_status", hc.Zone.Status, ExpectedEnableStatus)
|
||||
}
|
||||
|
||||
if hc.Cloudprovider != nil {
|
||||
if hc.Cloudprovider.Status != models.CLOUD_PROVIDER_CONNECTED {
|
||||
h.Exclude2("cloud_provider_status", hc.Cloudprovider.Status, models.CLOUD_PROVIDER_CONNECTED)
|
||||
|
||||
+3
-4
@@ -40,7 +40,7 @@ type baseHostDesc struct {
|
||||
NodeCount int64 `json:"node_count"`
|
||||
Tenants map[string]int64 `json:"tenants"`
|
||||
ZoneID string `json:"zone_id"`
|
||||
Zone string `json:"zone"`
|
||||
Zone *models.Zone `json:"zone"`
|
||||
PoolID string `json:"pool_id"`
|
||||
ClusterID string `json:"cluster_id"`
|
||||
Aggregates []*models.Aggregate `json:"aggregates"`
|
||||
@@ -110,7 +110,7 @@ func (b baseHostDesc) GetSchedDesc() *jsonutils.JSONDict {
|
||||
desc.Add(jsonutils.NewInt(b.MemSize), "mem_size")
|
||||
desc.Add(jsonutils.NewString(b.HostType), "host_type")
|
||||
desc.Add(jsonutils.NewString(b.ZoneID), "zone_id")
|
||||
desc.Add(jsonutils.NewString(b.Zone), "zone")
|
||||
desc.Add(jsonutils.NewString(b.Zone.Name), "zone")
|
||||
desc.Add(jsonutils.NewString(b.ResourceType), "resource_type")
|
||||
|
||||
if b.Cloudprovider != nil {
|
||||
@@ -146,8 +146,7 @@ func (b *baseHostDesc) fillZone(host *models.Host) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
b.ZoneID = zone.ID
|
||||
b.Zone = zone.Name
|
||||
b.Zone = zone
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
type Zone struct {
|
||||
StandaloneModel
|
||||
Status string `json:"status" gorm:"column:status;not null"`
|
||||
Location string `gorm:"column:location"`
|
||||
ManagerUri string `gorm:"column:manager_uri"`
|
||||
CloudregionId string `gorm:"column:cloudregion_id"`
|
||||
|
||||
Reference in New Issue
Block a user