diff --git a/src/core/mcis/provisioning.go b/src/core/mcis/provisioning.go index 855927ef6..3a17c4a9f 100644 --- a/src/core/mcis/provisioning.go +++ b/src/core/mcis/provisioning.go @@ -1625,14 +1625,16 @@ func CreateVm(nsId string, mcisId string, vmInfoData *TbVmInfo, option string) e // Try lookup customImage tempReq.ReqInfo.ImageName, err = common.GetCspResourceId(nsId, common.StrCustomImage, vmInfoData.ImageId) if tempReq.ReqInfo.ImageName == "" || err != nil { - common.CBLog.Error(err) + errAgg := err.Error() // If customImage doesn't exist, then try lookup image tempReq.ReqInfo.ImageName, err = common.GetCspResourceId(nsId, common.StrImage, vmInfoData.ImageId) if tempReq.ReqInfo.ImageName == "" || err != nil { - common.CBLog.Error(err) + errAgg += err.Error() // If cannot find the resource, use common resource tempReq.ReqInfo.ImageName, err = common.GetCspResourceId(common.SystemCommonNs, common.StrImage, vmInfoData.ImageId) if tempReq.ReqInfo.ImageName == "" || err != nil { + errAgg += err.Error() + err = fmt.Errorf(errAgg) common.CBLog.Error(err) return err } diff --git a/src/core/mcis/recommendation.go b/src/core/mcis/recommendation.go index e50549a43..c08483511 100644 --- a/src/core/mcis/recommendation.go +++ b/src/core/mcis/recommendation.go @@ -176,12 +176,12 @@ func RecommendVm(nsId string, plan DeploymentPlan) ([]mcir.TbSpecInfo, error) { case "random": prioritySpecs, err = RecommendVmRandom(nsId, &filteredSpecs) default: - prioritySpecs, err = RecommendVmRandom(nsId, &filteredSpecs) + prioritySpecs, err = RecommendVmCost(nsId, &filteredSpecs) } } if plan.Priority.Policy == nil { - prioritySpecs, err = RecommendVmRandom(nsId, &filteredSpecs) + prioritySpecs, err = RecommendVmCost(nsId, &filteredSpecs) } // limit the number of items in result list