mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #13013 from ioito/hotfix/qx-vpc-peer-connection-sync
fix(region): 对等连接同步状态恢复对端id
This commit is contained in:
@@ -355,11 +355,23 @@ func (self *SVpcPeeringConnection) syncRemove(ctx context.Context, userCred mccl
|
||||
}
|
||||
|
||||
func (self *SVpcPeeringConnection) SyncWithCloudPeerConnection(ctx context.Context, userCred mcclient.TokenCredential, ext cloudprovider.ICloudVpcPeeringConnection, provider *SCloudprovider) error {
|
||||
_, err := db.Update(self, func() error {
|
||||
vpc, err := self.GetVpc()
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, "GetVpc")
|
||||
}
|
||||
_, err = db.Update(self, func() error {
|
||||
self.Status = ext.GetStatus()
|
||||
self.ExternalId = ext.GetGlobalId()
|
||||
self.ExtPeerVpcId = ext.GetPeerVpcId()
|
||||
self.ExtPeerAccountId = ext.GetPeerAccountId()
|
||||
peerVpc, _ := db.FetchByExternalIdAndManagerId(VpcManager, self.ExtPeerVpcId, func(q *sqlchemy.SQuery) *sqlchemy.SQuery {
|
||||
managerQ := CloudproviderManager.Query("id").Equals("provider", vpc.GetProviderName())
|
||||
return q.In("manager_id", managerQ.SubQuery())
|
||||
})
|
||||
if peerVpc != nil {
|
||||
self.PeerVpcId = peerVpc.GetId()
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user