修复不支持redis的公有云账号会频繁读取oss数据的问题

This commit is contained in:
TangBin
2019-11-27 11:30:41 +08:00
parent 2c87f5b0ac
commit 25b04f50be
5 changed files with 22 additions and 7 deletions

View File

@@ -127,14 +127,16 @@ func syncRegionSkus(ctx context.Context, userCred mcclient.TokenCredential, loca
}
}
cnt, err = ElasticcacheSkuManager.GetSkuCountByRegion(regionId)
if err != nil {
log.Errorf("ElasticcacheSkuManager.GetSkuCountByRegion fail %s", err)
return
}
if localRegion.GetDriver().IsSupportedElasticcache() {
cnt, err = ElasticcacheSkuManager.GetSkuCountByRegion(regionId)
if err != nil {
log.Errorf("ElasticcacheSkuManager.GetSkuCountByRegion fail %s", err)
return
}
if cnt == 0 {
syncElasticCacheSkusByRegion(ctx, userCred, localRegion)
if cnt == 0 {
syncElasticCacheSkusByRegion(ctx, userCred, localRegion)
}
}
}

View File

@@ -142,6 +142,7 @@ type IRegionDriver interface {
}
type IElasticcacheDriver interface {
IsSupportedElasticcache() bool
AllowCreateElasticcacheBackup(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, elasticcache *SElasticcache) error
AllowUpdateElasticcacheAuthMode(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, elasticcache *SElasticcache) error
ValidateCreateElasticcacheData(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, data *jsonutils.JSONDict) (*jsonutils.JSONDict, error)

View File

@@ -1535,3 +1535,7 @@ func (self *SAliyunRegionDriver) RequestElasticcacheAccountResetPassword(ctx con
return ea.SyncWithCloudElasticcacheAccount(ctx, userCred, iea)
}
func (self *SAliyunRegionDriver) IsSupportedElasticcache() bool {
return true
}

View File

@@ -294,3 +294,7 @@ func (self *SBaseRegionDriver) ValidateResetDBInstancePassword(ctx context.Conte
func (self *SBaseRegionDriver) IsSupportKeepDBInstanceManualBackup() bool {
return false
}
func (self *SBaseRegionDriver) IsSupportedElasticcache() bool {
return false
}

View File

@@ -2562,3 +2562,7 @@ func (self *SHuaWeiRegionDriver) AllowCreateElasticcacheBackup(ctx context.Conte
func (self *SHuaWeiRegionDriver) AllowUpdateElasticcacheAuthMode(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, elasticcache *models.SElasticcache) error {
return fmt.Errorf("not support update huawei elastic cache auth_mode")
}
func (self *SHuaWeiRegionDriver) IsSupportedElasticcache() bool {
return true
}