diff --git a/pkg/compute/models/dbinstances.go b/pkg/compute/models/dbinstances.go index 395bbeb12e..77067fcfcd 100644 --- a/pkg/compute/models/dbinstances.go +++ b/pkg/compute/models/dbinstances.go @@ -1287,6 +1287,13 @@ func (manager *SDBInstanceManager) SyncDBInstances(ctx context.Context, userCred return nil, nil, syncResult } + for i := range dbInstances { + if taskman.TaskManager.IsInTask(&dbInstances[i]) { + syncResult.Error(fmt.Errorf("dbInstance %s(%s)in task", dbInstances[i].Name, dbInstances[i].Id)) + return nil, nil, syncResult + } + } + removed := make([]SDBInstance, 0) commondb := make([]SDBInstance, 0) commonext := make([]cloudprovider.ICloudDBInstance, 0) diff --git a/pkg/compute/models/elasticcache_instances.go b/pkg/compute/models/elasticcache_instances.go index dad58aa407..4c9251e00c 100644 --- a/pkg/compute/models/elasticcache_instances.go +++ b/pkg/compute/models/elasticcache_instances.go @@ -448,6 +448,13 @@ func (manager *SElasticcacheManager) SyncElasticcaches(ctx context.Context, user return nil, nil, syncResult } + for i := range dbInstances { + if taskman.TaskManager.IsInTask(&dbInstances[i]) { + syncResult.Error(fmt.Errorf("ElasticCacheInstance %s(%s)in task", dbInstances[i].Name, dbInstances[i].Id)) + return nil, nil, syncResult + } + } + removed := make([]SElasticcache, 0) commondb := make([]SElasticcache, 0) commonext := make([]cloudprovider.ICloudElasticcache, 0) diff --git a/pkg/compute/models/loadbalancers.go b/pkg/compute/models/loadbalancers.go index 62d9fe1bf8..2b6eb8be55 100644 --- a/pkg/compute/models/loadbalancers.go +++ b/pkg/compute/models/loadbalancers.go @@ -706,6 +706,13 @@ func (man *SLoadbalancerManager) SyncLoadbalancers(ctx context.Context, userCred return nil, nil, syncResult } + for i := range dbLbs { + if taskman.TaskManager.IsInTask(&dbLbs[i]) { + syncResult.Error(fmt.Errorf("loadbalancer %s(%s)in task", dbLbs[i].Name, dbLbs[i].Id)) + return nil, nil, syncResult + } + } + removed := []SLoadbalancer{} commondb := []SLoadbalancer{} commonext := []cloudprovider.ICloudLoadbalancer{}