diff --git a/pkg/scheduler/algorithm/predicates/class_metadata_predicate.go b/pkg/scheduler/algorithm/predicates/class_metadata_predicate.go index a6b13f4b0b..74118cc0fd 100644 --- a/pkg/scheduler/algorithm/predicates/class_metadata_predicate.go +++ b/pkg/scheduler/algorithm/predicates/class_metadata_predicate.go @@ -18,11 +18,13 @@ import ( "context" "fmt" + "yunion.io/x/jsonutils" "yunion.io/x/pkg/errors" "yunion.io/x/onecloud/pkg/cloudcommon/db" "yunion.io/x/onecloud/pkg/compute/models" "yunion.io/x/onecloud/pkg/scheduler/core" + "yunion.io/x/onecloud/pkg/util/rbacutils" ) type ClassMetadataPredicate struct { @@ -97,8 +99,13 @@ func (p *ClassMetadataPredicate) PreExecute(u *core.Unit, cs []core.Candidater) if err != nil { return false, errors.Wrapf(err, "unable to fetch cachedimage %s", disks[0].ImageId) } - stand = &obj.SStandaloneAnonResourceBase - guestSource.keyword = "image" + // no check if image if system public image + public := jsonutils.QueryBoolean(obj.Info, "is_public", false) + publicScope, _ := obj.Info.GetString("public_scope") + if !public || publicScope != string(rbacutils.ScopeSystem) { + stand = &obj.SStandaloneAnonResourceBase + guestSource.keyword = "image" + } case disks[0].SnapshotId != "": obj, err := models.SnapshotManager.FetchById(disks[0].SnapshotId) if err != nil {