mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #8776 from zhaoxiangchun/bugfix/zxc-commonalert
suggestalet bugfix
This commit is contained in:
@@ -205,6 +205,11 @@ func (man *SSuggestSysAlertManager) ValidateCreateData(
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func (self *SSuggestSysAlert) CustomizeCreate(ctx context.Context, userCred mcclient.TokenCredential,
|
||||
ownerId mcclient.IIdentityProvider, query jsonutils.JSONObject, data jsonutils.JSONObject) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (man *SSuggestSysAlertManager) FetchCustomizeColumns(
|
||||
ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
@@ -319,7 +324,7 @@ func (self *SSuggestSysAlert) Delete(ctx context.Context, userCred mcclient.Toke
|
||||
}
|
||||
|
||||
func (self *SSuggestSysAlert) RealDelete(ctx context.Context, userCred mcclient.TokenCredential) error {
|
||||
return db.DeleteModel(ctx, userCred, self)
|
||||
return self.SVirtualResourceBase.Delete(ctx, userCred)
|
||||
}
|
||||
|
||||
func (self *SSuggestSysAlert) StartDeleteTask(
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
"yunion.io/x/pkg/errors"
|
||||
|
||||
compute_api "yunion.io/x/onecloud/pkg/apis/compute"
|
||||
"yunion.io/x/onecloud/pkg/apis/monitor"
|
||||
@@ -94,27 +95,18 @@ func (drv *SecGroupRuleInServer) getSecGroupIdsInThisRule() ([]string, error) {
|
||||
}
|
||||
|
||||
func (drv *SecGroupRuleInServer) getServersBySecGroupIds(secGroupIdArr []string) ([]jsonutils.JSONObject, error) {
|
||||
i, count := 1, 0
|
||||
param := jsonutils.NewDict()
|
||||
param.Add(jsonutils.NewString("hypervisor.notin(baremetal,container)"), "filter.0")
|
||||
filterSecGroupIds := make([]string, 0)
|
||||
jump := false
|
||||
for {
|
||||
tmp := count + 50
|
||||
if tmp > len(secGroupIdArr) {
|
||||
tmp = len(secGroupIdArr)
|
||||
jump = true
|
||||
servers := make([]jsonutils.JSONObject, 0)
|
||||
for _, secGroupId := range secGroupIdArr {
|
||||
param.Set("secgroup_id", jsonutils.NewString(secGroupId))
|
||||
serversPart, err := ListAllResources(&modules.Servers, param)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "SecGroupRuleInServer getServers error")
|
||||
}
|
||||
filterSecGroupIds = secGroupIdArr[count:tmp]
|
||||
param.Add(jsonutils.NewString(fmt.Sprintf("`secgroup.in(%s)", strings.Join(filterSecGroupIds, ","))),
|
||||
fmt.Sprintf("filter.%d", i))
|
||||
if jump {
|
||||
break
|
||||
}
|
||||
i++
|
||||
count = tmp
|
||||
servers = append(servers, serversPart...)
|
||||
}
|
||||
return ListAllResources(&modules.Servers, param)
|
||||
return servers, nil
|
||||
}
|
||||
|
||||
func (drv *SecGroupRuleInServer) StartResolveTask(ctx context.Context, userCred mcclient.TokenCredential,
|
||||
|
||||
Reference in New Issue
Block a user