Merge pull request #299 in YUNIONIO/onecloud from bugfix/rex-20181016-aliyun-reset-actionlog to release/2.2.0

* commit '1736eacb2157825a5c91daed4d977b26f18d6d92':
  调整带宽 task: CLOUD-561云服务器调整带宽后,操作日志记录的内容应该准确
  增加日志服务黑名单,去掉配置服务的操作日志
This commit is contained in:
邱剑
2018-10-17 17:43:46 +08:00
2 changed files with 17 additions and 2 deletions
+6 -1
View File
@@ -2886,10 +2886,12 @@ func (self *SGuest) PerformChangeBandwidth(ctx context.Context, userCred mcclien
guestnics := self.GetNetworks()
index, err := data.Int("index")
if err != nil || index > int64(len(guestnics)) {
logclient.AddActionLog(self, logclient.ACT_VM_CHANGE_BANDWIDTH, "Index Not fount or out of NIC index", userCred, false)
return nil, httperrors.NewBadRequestError("Index Not fount or out of NIC index")
}
bandwidth, err := data.Int("bandwidth")
if err != nil || bandwidth <= 0 {
logclient.AddActionLog(self, logclient.ACT_VM_CHANGE_BANDWIDTH, "Bandwidth must be larger than 0", userCred, false)
return nil, httperrors.NewBadRequestError("Bandwidth must be larger than 0")
}
guestnic := &guestnics[index]
@@ -2899,11 +2901,14 @@ func (self *SGuest) PerformChangeBandwidth(ctx context.Context, userCred mcclien
return nil
})
err := self.StartSyncTask(ctx, userCred, false, "")
logclient.AddActionLog(self, logclient.ACT_VM_CHANGE_BANDWIDTH, err, userCred, err == nil)
return nil, err
}
return nil, nil
}
return nil, httperrors.NewBadRequestError("Cannot change bandwidth in status %s", self.Status)
msg := fmt.Sprintf("Cannot change bandwidth in status %s", self.Status)
logclient.AddActionLog(self, logclient.ACT_VM_CHANGE_BANDWIDTH, msg, userCred, false)
return nil, httperrors.NewBadRequestError(msg)
}
func (self *SGuest) AllowPerformChangeConfig(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool {