From 423ef544e27caab508dfb9d309e8b6afdcdb0f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Sat, 16 Feb 2019 17:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B6=85=E5=94=AE=E6=AF=94?= =?UTF-8?q?=E5=90=8E=E7=AB=8B=E5=8D=B3=E5=88=B7=E6=96=B0=E8=B0=83=E5=BA=A6?= =?UTF-8?q?=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/compute/models/storages.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkg/compute/models/storages.go b/pkg/compute/models/storages.go index dd8f139315..25b3fa3c16 100644 --- a/pkg/compute/models/storages.go +++ b/pkg/compute/models/storages.go @@ -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) }