fix(region): rds skip notImplementedErr (#18704)

* fix(region): rds skip notImplementedErr

* fix(region): aws redis set metadata status

---------

Co-authored-by: 马鸿飞 <mahongfei@yunion.cn>
This commit is contained in:
gouqi11
2023-11-16 17:20:26 +08:00
committed by GitHub
co-authored by 马鸿飞
parent 26a2210d63
commit 30f8488238
2 changed files with 48 additions and 2 deletions
+45
View File
@@ -34,6 +34,7 @@ import (
"yunion.io/x/onecloud/pkg/compute/models"
"yunion.io/x/onecloud/pkg/httperrors"
"yunion.io/x/onecloud/pkg/mcclient"
"yunion.io/x/onecloud/pkg/util/logclient"
"yunion.io/x/onecloud/pkg/util/seclib2"
)
@@ -427,3 +428,47 @@ func (self *SAwsRegionDriver) ValidateUpdateSecurityGroupRuleInput(ctx context.C
return self.SManagedVirtualizationRegionDriver.ValidateUpdateSecurityGroupRuleInput(ctx, userCred, input)
}
func (self *SAwsRegionDriver) RequestRemoteUpdateElasticcache(ctx context.Context, userCred mcclient.TokenCredential, elasticcache *models.SElasticcache, replaceTags bool, task taskman.ITask) error {
taskman.LocalTaskRun(task, func() (jsonutils.JSONObject, error) {
iRegion, err := elasticcache.GetIRegion(ctx)
if err != nil {
return nil, errors.Wrap(err, "elasticcache.GetIRegion")
}
iElasticcache, err := iRegion.GetIElasticcacheById(elasticcache.ExternalId)
if err != nil {
return nil, errors.Wrapf(err, "GetIElasticcacheById(%s)", elasticcache.ExternalId)
}
oldTags, err := iElasticcache.GetTags()
if err != nil {
if errors.Cause(err) == cloudprovider.ErrNotSupported || errors.Cause(err) == cloudprovider.ErrNotImplemented {
return nil, nil
}
return nil, errors.Wrap(err, "iElasticcache.GetTags()")
}
tags, err := elasticcache.GetAllUserMetadata()
if err != nil {
return nil, errors.Wrapf(err, "GetAllUserMetadata")
}
tagsUpdateInfo := cloudprovider.TagsUpdateInfo{OldTags: oldTags, NewTags: tags}
mangerId := ""
if vpc, _ := elasticcache.GetVpc(); vpc != nil {
mangerId = vpc.ManagerId
}
err = cloudprovider.SetTags(ctx, iElasticcache, mangerId, tags, replaceTags)
if err != nil {
if errors.Cause(err) == cloudprovider.ErrNotSupported || errors.Cause(err) == cloudprovider.ErrNotImplemented {
return nil, nil
}
logclient.AddActionLogWithStartable(task, elasticcache, logclient.ACT_UPDATE_TAGS, err, userCred, false)
return nil, errors.Wrap(err, "iElasticcache.SetTags")
}
cloudprovider.WaitMultiStatus(iElasticcache, []string{api.ELASTIC_CACHE_STATUS_RUNNING}, 15*time.Second, 2*time.Minute)
logclient.AddActionLogWithStartable(task, elasticcache, logclient.ACT_UPDATE_TAGS, tagsUpdateInfo, userCred, true)
return nil, nil
})
return nil
}
+3 -2
View File
@@ -2411,9 +2411,10 @@ func (self *SManagedVirtualizationRegionDriver) RequestRemoteUpdateDBInstance(ct
err = iRds.Update(ctx, cloudprovider.SDBInstanceUpdateOptions{NAME: instance.Name, Description: instance.Description})
if err != nil {
if errors.Cause(err) != cloudprovider.ErrNotSupported {
return nil, errors.Wrap(err, "iRds.Update")
if errors.Cause(err) == cloudprovider.ErrNotSupported || errors.Cause(err) == cloudprovider.ErrNotImplemented {
return nil, nil
}
return nil, errors.Wrap(err, "iRds.Update")
}
return nil, nil
})