fix(scheduler): Candidater's CloudProvider maybe nil

Candidater(Host) in Provider Onecloud doesn't have CloudProvider.
This commit is contained in:
Rain
2020-03-13 11:26:42 +08:00
parent 61757b8e8a
commit 8ebb409ef3
@@ -227,7 +227,9 @@ func (cm *CandidateManager) GetCandidates(args CandidateGetArgs) ([]core.Candida
matchCloudprovider := func(r core.Candidater, managerId string) bool {
if managerId != "" {
if r.Getter().Cloudprovider().GetId() == managerId {
cloudProvier := r.Getter().Cloudprovider()
// r who belongs to Provider Onecloud doesn't have cloudprovider
if cloudProvier != nil && cloudProvier.GetId() == managerId {
return true
}
return false