Merge pull request #1069 in YUNIONIO/onecloud from ~QUXUAN/onecloud:hotfix/qx-storage-refresh-scheduler-cache to release/2.3.0

* commit '423ef544e27caab508dfb9d309e8b6afdcdb0f0e':
  修改超售比后立即刷新调度缓存
This commit is contained in:
邱剑
2019-02-16 22:21:27 +08:00
+13
View File
@@ -137,6 +137,19 @@ func (self *SStorage) AllowUpdateItem(ctx context.Context, userCred mcclient.Tok
return db.IsAdminAllowUpdate(userCred, self)
}
func (self *SStorage) PostUpdate(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) {
self.SEnabledStatusStandaloneResourceBase.PostUpdate(ctx, userCred, query, data)
if data.Contains("cmtbound") {
hosts := self.GetAttachedHosts()
for _, host := range hosts {
if err := host.ClearSchedDescCache(); err != nil {
log.Errorf("clear host %s sched cache failed %v", host.GetName(), err)
}
}
}
}
func (self *SStorage) AllowDeleteItem(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool {
return db.IsAdminAllowDelete(userCred, self)
}