diff --git a/pkg/apis/compute/zz_generated.model.go b/pkg/apis/compute/zz_generated.model.go index e00bac475c..bd320f93b3 100644 --- a/pkg/apis/compute/zz_generated.model.go +++ b/pkg/apis/compute/zz_generated.model.go @@ -80,7 +80,7 @@ type SBillingResourceBase struct { // SBucket is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SBucket. type SBucket struct { - apis.SVirtualResourceBase + apis.SSharableVirtualResourceBase apis.SExternalizedResourceBase SCloudregionResourceBase SManagedResourceBase @@ -931,7 +931,7 @@ type SHost struct { SysInfo interface{} `json:"sys_info"` // 物理机序列号信息 SN string `json:"sn"` - // CPU大小 + // CPU核数 CpuCount int `json:"cpu_count"` // 物理CPU颗数 NodeCount byte `json:"node_count"` @@ -1720,6 +1720,8 @@ type SScalingGroup struct { LoadbalancerBackendWeight int `json:"loadbalancer_backend_weight"` // Time to allow scale AllowScaleTime time.Time `json:"allow_scale_time"` + // NextCheckTime descripe the next time to check instance's health + NextCheckTime time.Time `json:"next_check_time"` } // SScalingGroupGuest is an autogenerated struct via yunion.io/x/onecloud/pkg/compute/models.SScalingGroupGuest. diff --git a/pkg/apis/list.go b/pkg/apis/list.go index 4ea1945cdd..34471912a6 100644 --- a/pkg/apis/list.go +++ b/pkg/apis/list.go @@ -107,11 +107,11 @@ type ModelBaseListInput struct { Filter []string `json:"filter"` // 指定关联过滤条件,允许指定多个,后端将根据关联过滤条件和其他表关联查询,支持的查询语法和filter相同, // 和其他表关联的语法如下: - // joint_tbl.related_key(origin_key).filter_col.filter_ops(values) - // 其中,joint_tbl为要关联的表,related_key为关联表column,origin_key为当前表column, filter_col为 + // joint_resources.related_key(origin_key).filter_col.filter_ops(values) + // 其中,joint_resources为要关联的资源名称,related_key为关联表column,origin_key为当前表column, filter_col为 // 关联表用于查询匹配的field名称,field_ops为filter支持的操作,values为匹配的值 // 举例: - // guestnetworks_tbl.guest_id(id).ip_addr.equals('10.168.21.222') + // guestnetworks.guest_id(id).ip_addr.equals('10.168.21.222') JointFilter []string `json:"joint_filter"` // 如果filter_any为true,则查询所有filter的并集,否则为交集 FilterAny *bool `json:"filter_any"` diff --git a/pkg/cloudcommon/db/db_dispatcher.go b/pkg/cloudcommon/db/db_dispatcher.go index 4d0c075f88..6a9c37b24b 100644 --- a/pkg/cloudcommon/db/db_dispatcher.go +++ b/pkg/cloudcommon/db/db_dispatcher.go @@ -215,6 +215,9 @@ func applyListItemsGeneralJointFilters(manager IModelManager, q *sqlchemy.SQuery jfc := filterclause.ParseJointFilterClause(f) if jfc != nil { jointModelManager := GetModelManager(jfc.GetJointModelName()) + if jointModelManager == nil { + return nil, httperrors.NewResourceNotFoundError("invalid joint resources %s", jfc.GetJointModelName()) + } schFields := searchFields(jointModelManager, userCred) if schFields.Contains(jfc.GetField()) { sq := jointModelManager.Query(jfc.RelatedKey) @@ -300,7 +303,10 @@ func listItemQueryFiltersRaw(manager IModelManager, } jointFilter := jsonutils.GetQueryStringArray(query, "joint_filter") if len(jointFilter) > 0 { - q, _ = applyListItemsGeneralJointFilters(manager, q, userCred, jointFilter, filterAny) + q, err = applyListItemsGeneralJointFilters(manager, q, userCred, jointFilter, filterAny) + if err != nil { + return nil, err + } } return q, nil }