mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #1347 from Zexi/feature/schedule-guestdriver-interface
scheduler: add schedule filter interface to guestdriver
This commit is contained in:
@@ -34,7 +34,7 @@ func (f *CPUPredicate) Clone() core.FitPredicate {
|
||||
}
|
||||
|
||||
func (f *CPUPredicate) PreExecute(u *core.Unit, cs []core.Candidater) (bool, error) {
|
||||
if u.IsPublicCloudProvider() {
|
||||
if !u.GetHypervisorDriver().DoScheduleCPUFilter() {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ func (p *MemoryPredicate) Clone() core.FitPredicate {
|
||||
}
|
||||
|
||||
func (p *MemoryPredicate) PreExecute(u *core.Unit, cs []core.Candidater) (bool, error) {
|
||||
if u.IsPublicCloudProvider() {
|
||||
if !u.GetHypervisorDriver().DoScheduleMemoryFilter() {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ func (p *StoragePredicate) Clone() core.FitPredicate {
|
||||
}
|
||||
|
||||
func (p *StoragePredicate) PreExecute(u *core.Unit, cs []core.Candidater) (bool, error) {
|
||||
if u.IsPublicCloudProvider() {
|
||||
if !u.GetHypervisorDriver().DoScheduleStorageFilter() {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
|
||||
@@ -336,10 +336,7 @@ func (p *BaseSchedtagPredicate) PreExecute(sp ISchedtagPredicateInstance, u *cor
|
||||
return false, nil
|
||||
}
|
||||
|
||||
p.Hypervisor = computeapi.HOSTTYPE_HYPERVISOR[u.SchedData().Hypervisor]
|
||||
if len(p.Hypervisor) == 0 {
|
||||
p.Hypervisor = u.SchedData().Hypervisor
|
||||
}
|
||||
p.Hypervisor = u.GetHypervisor()
|
||||
|
||||
// always do select step
|
||||
u.AppendSelectPlugin(sp)
|
||||
|
||||
@@ -34,7 +34,7 @@ func (p *InstanceTypePredicate) Clone() core.FitPredicate {
|
||||
}
|
||||
|
||||
func (p *InstanceTypePredicate) PreExecute(u *core.Unit, cs []core.Candidater) (bool, error) {
|
||||
if u.SchedData().InstanceType == "" || !u.IsPublicCloudProvider() {
|
||||
if u.SchedData().InstanceType == "" || !u.GetHypervisorDriver().DoScheduleSKUFilter() {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
|
||||
Reference in New Issue
Block a user