mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
Merge pull request #7234 from ioito/hotfix/qx-global-vpc-share
fix: globalvpc跟随云账号共享
This commit is contained in:
@@ -384,7 +384,7 @@ func (manager *SVpcManager) SyncVPCs(ctx context.Context, userCred mcclient.Toke
|
||||
localVPCs = append(localVPCs, commondb[i])
|
||||
remoteVPCs = append(remoteVPCs, commonext[i])
|
||||
syncResult.Update()
|
||||
err = commondb[i].SyncGlobalVpc(ctx, userCred, provider.GetOwnerId())
|
||||
err = commondb[i].SyncGlobalVpc(ctx, userCred, provider.GetOwnerId(), provider)
|
||||
if err != nil {
|
||||
log.Errorf("%s(%s) sync global vpc error: %v", commondb[i].Name, commondb[i].Id, err)
|
||||
}
|
||||
@@ -399,7 +399,7 @@ func (manager *SVpcManager) SyncVPCs(ctx context.Context, userCred mcclient.Toke
|
||||
localVPCs = append(localVPCs, *newVpc)
|
||||
remoteVPCs = append(remoteVPCs, added[i])
|
||||
syncResult.Add()
|
||||
err = newVpc.SyncGlobalVpc(ctx, userCred, provider.GetOwnerId())
|
||||
err = newVpc.SyncGlobalVpc(ctx, userCred, provider.GetOwnerId(), provider)
|
||||
if err != nil {
|
||||
log.Errorf("%s(%s) sync global vpc error: %v", newVpc.Name, newVpc.Id, err)
|
||||
}
|
||||
@@ -429,10 +429,11 @@ func (self *SVpc) syncRemoveCloudVpc(ctx context.Context, userCred mcclient.Toke
|
||||
return err
|
||||
}
|
||||
|
||||
func (self *SVpc) SyncGlobalVpc(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider) error {
|
||||
func (self *SVpc) SyncGlobalVpc(ctx context.Context, userCred mcclient.TokenCredential, ownerId mcclient.IIdentityProvider, provider *SCloudprovider) error {
|
||||
if len(self.GlobalvpcId) > 0 {
|
||||
gv, _ := self.GetGlobalVpc()
|
||||
SyncCloudDomain(userCred, gv, ownerId)
|
||||
gv.SyncShareState(ctx, userCred, provider.getAccountShareInfo())
|
||||
return nil
|
||||
}
|
||||
region, err := self.GetRegion()
|
||||
@@ -476,6 +477,7 @@ func (self *SVpc) SyncGlobalVpc(ctx context.Context, userCred mcclient.TokenCred
|
||||
return errors.Wrap(err, "GlobalVpcManager.Insert")
|
||||
}
|
||||
SyncCloudDomain(userCred, gv, ownerId)
|
||||
gv.SyncShareState(ctx, userCred, provider.getAccountShareInfo())
|
||||
globalvpcId = gv.Id
|
||||
}
|
||||
_, err = db.Update(self, func() error {
|
||||
|
||||
Reference in New Issue
Block a user