Files
cloudpods/pkg/scheduler/algorithmprovider/defaults.go
rainzm fa0450b454 feat(scheduler): Change the action for guests with backup and instanceGroup
1. 对于主机组的打散功能,放在调度的最后单独处理。
2. 主备机的调度,通过在主机和备机之间设置一个粒度为1的主机组来实现。
3. 虚拟机的调度默认打散,在打散的基础上,选择容量大的宿主机。
3. 主备机中,主机和备机的默认打散流程分散开,互不影响。
2020-07-21 20:29:47 +08:00

60 lines
3.0 KiB
Go

// Copyright 2019 Yunion
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package algorithmprovider
import (
"yunion.io/x/pkg/util/sets"
"yunion.io/x/onecloud/pkg/scheduler/algorithm/predicates"
predicateguest "yunion.io/x/onecloud/pkg/scheduler/algorithm/predicates/guest"
priorityguest "yunion.io/x/onecloud/pkg/scheduler/algorithm/priorities/guest"
"yunion.io/x/onecloud/pkg/scheduler/factory"
)
func init() {
factory.RegisterAlgorithmProvider(factory.DefaultProvider, defaultPredicates(), defaultPriorities())
}
func defaultPredicates() sets.String {
return sets.NewString(
factory.RegisterFitPredicate("a-GuestHostStatusFilter", &predicateguest.StatusPredicate{}),
factory.RegisterFitPredicate("b-GuestHypervisorFilter", &predicateguest.HypervisorPredicate{}),
factory.RegisterFitPredicate("c-GuestAggregateFilter", &predicates.AggregatePredicate{}),
factory.RegisterFitPredicate("d-GuestMigrateFilter", &predicateguest.MigratePredicate{}),
factory.RegisterFitPredicate("e-GuestDomainFilter", &predicates.DomainPredicate{}),
factory.RegisterFitPredicate("e-GuestImageFilter", &predicateguest.ImagePredicate{}),
//factory.RegisterFitPredicate("f-GuestGroupFilter", &predicateguest.GroupPredicate{}),
factory.RegisterFitPredicate("g-GuestCPUFilter", &predicateguest.CPUPredicate{}),
factory.RegisterFitPredicate("h-GuestMemoryFilter", &predicateguest.MemoryPredicate{}),
factory.RegisterFitPredicate("i-GuestStorageFilter", &predicateguest.StoragePredicate{}),
factory.RegisterFitPredicate("j-GuestNetworkFilter", &predicates.NetworkPredicate{}),
factory.RegisterFitPredicate("k-GuestIsolatedDeviceFilter", &predicateguest.IsolatedDevicePredicate{}),
factory.RegisterFitPredicate("l-GuestResourceTypeFilter", &predicates.ResourceTypePredicate{}),
factory.RegisterFitPredicate("m-GuestDiskschedtagFilter", &predicates.DiskSchedtagPredicate{}),
factory.RegisterFitPredicate("n-ServerSkuFilter", &predicates.InstanceTypePredicate{}),
factory.RegisterFitPredicate("o-GuestNetschedtagFilter", &predicates.NetworkSchedtagPredicate{}),
factory.RegisterFitPredicate("z-QuotaFilter", &predicates.SQuotaPredicate{}),
)
}
func defaultPriorities() sets.String {
return sets.NewString(
factory.RegisterPriority("guest-avoid-same-host", &priorityguest.AvoidSameHostPriority{}, 1),
factory.RegisterPriority("guest-lowload", &priorityguest.LowLoadPriority{}, 1),
factory.RegisterPriority("guest-creating", &priorityguest.CreatingPriority{}, 1),
factory.RegisterPriority("guest-capacity", &priorityguest.CapacityPriority{}, 1),
)
}