diff --git a/pkg/cloudcommon/db/caller.go b/pkg/cloudcommon/db/caller.go index b68793e421..3e1bc8ab0d 100644 --- a/pkg/cloudcommon/db/caller.go +++ b/pkg/cloudcommon/db/caller.go @@ -58,11 +58,10 @@ func call(obj interface{}, fName string, inputs ...interface{}) ([]reflect.Value func callObject(modelVal reflect.Value, fName string, inputs ...interface{}) ([]reflect.Value, error) { funcVal := modelVal.MethodByName(fName) - return callFunc(funcVal, inputs...) + return callFunc(funcVal, fName, inputs...) } -func callFunc(funcVal reflect.Value, inputs ...interface{}) ([]reflect.Value, error) { - fName := funcVal.String() +func callFunc(funcVal reflect.Value, fName string, inputs ...interface{}) ([]reflect.Value, error) { if !funcVal.IsValid() || funcVal.IsNil() { return nil, httperrors.NewActionNotFoundError(fmt.Sprintf("%s method not found", fName)) } diff --git a/pkg/cloudcommon/db/db_dispatcher.go b/pkg/cloudcommon/db/db_dispatcher.go index a83ff34ab3..3d2b6f08ce 100644 --- a/pkg/cloudcommon/db/db_dispatcher.go +++ b/pkg/cloudcommon/db/db_dispatcher.go @@ -847,7 +847,7 @@ func (dispatcher *DBModelDispatcher) tryGetModelProperty(ctx context.Context, pr } userCred := fetchUserCredential(ctx) params := []interface{}{ctx, userCred, query} - outs, err := callFunc(funcValue, params...) + outs, err := callFunc(funcValue, allowFuncName, params...) if err != nil { return nil, httperrors.NewInternalServerError("reflect call %s fail %s", allowFuncName, err) } @@ -859,7 +859,7 @@ func (dispatcher *DBModelDispatcher) tryGetModelProperty(ctx context.Context, pr } funcValue = modelValue.MethodByName(funcName) - outs, err = callFunc(funcValue, params...) + outs, err = callFunc(funcValue, funcName, params...) if err != nil { return nil, httperrors.NewInternalServerError("reflect call %s fail %s", funcName, err) } @@ -943,7 +943,7 @@ func (dispatcher *DBModelDispatcher) GetSpecific(ctx context.Context, idStr stri return nil, httperrors.NewSpecNotFoundError("%s %s %s not found", dispatcher.Keyword(), idStr, spec) } - outs, err := callFunc(funcValue, params...) + outs, err := callFunc(funcValue, funcName, params...) if err != nil { return nil, err } @@ -961,7 +961,7 @@ func (dispatcher *DBModelDispatcher) GetSpecific(ctx context.Context, idStr stri return nil, httperrors.NewSpecNotFoundError("%s %s %s not found", dispatcher.Keyword(), idStr, spec) } - outs, err := callFunc(funcValue, params...) + outs, err := callFunc(funcValue, funcName, params...) if err != nil { return nil, err } @@ -1526,7 +1526,7 @@ func reflectDispatcherInternal( return nil, httperrors.NewActionNotFoundError(msg) } - outs, err := callFunc(allowFuncValue, params...) + outs, err := callFunc(allowFuncValue, allowFuncName, params...) if err != nil { return nil, err } @@ -1539,7 +1539,7 @@ func reflectDispatcherInternal( } } - outs, err := callFunc(funcValue, params...) + outs, err := callFunc(funcValue, funcName, params...) if err != nil { return nil, err } diff --git a/pkg/compute/models/dbinstance_skus.go b/pkg/compute/models/dbinstance_skus.go index 2820bd49bc..3deb7d86c0 100644 --- a/pkg/compute/models/dbinstance_skus.go +++ b/pkg/compute/models/dbinstance_skus.go @@ -168,6 +168,10 @@ func (manager *SDBInstanceSkuManager) ListItemFilter( return q, nil } +func (self *SDBInstanceSku) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, isList bool) (api.DBInstanceSkuDetails, error) { + return api.DBInstanceSkuDetails{}, nil +} + func (manager *SDBInstanceSkuManager) FetchCustomizeColumns( ctx context.Context, userCred mcclient.TokenCredential,