mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix: 修复vpc同步异常问题
This commit is contained in:
@@ -250,6 +250,16 @@ func (self *SCloudregion) GetVpcs() ([]SVpc, error) {
|
||||
return vpcs, nil
|
||||
}
|
||||
|
||||
func (self *SCloudregion) GetCloudproviderVpcs(managerId string) ([]SVpc, error) {
|
||||
vpcs := []SVpc{}
|
||||
q := self.GetVpcQuery().Equals("manager_id", managerId)
|
||||
err := db.FetchModelObjects(VpcManager, q, &vpcs)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "db.FetchModelObjects")
|
||||
}
|
||||
return vpcs, nil
|
||||
}
|
||||
|
||||
func (self *SCloudregion) GetDriver() IRegionDriver {
|
||||
provider := self.Provider
|
||||
if len(provider) == 0 {
|
||||
|
||||
@@ -343,7 +343,7 @@ func (manager *SVpcManager) SyncVPCs(ctx context.Context, userCred mcclient.Toke
|
||||
remoteVPCs := make([]cloudprovider.ICloudVpc, 0)
|
||||
syncResult := compare.SyncResult{}
|
||||
|
||||
dbVPCs, err := region.GetVpcs()
|
||||
dbVPCs, err := region.GetCloudproviderVpcs(provider.Id)
|
||||
if err != nil {
|
||||
syncResult.Error(err)
|
||||
return nil, nil, syncResult
|
||||
|
||||
Reference in New Issue
Block a user