mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): huawei region id with project name
This commit is contained in:
@@ -206,17 +206,21 @@ func (self *SHuaweiClient) fetchRegions() error {
|
||||
|
||||
regionId := strings.Split(project.Name, "_")[0]
|
||||
for _, region := range self.regions {
|
||||
if region.ID == regionId {
|
||||
if region.ID == regionId || project.Name == region.ID {
|
||||
filtedRegions = append(filtedRegions, region)
|
||||
}
|
||||
}
|
||||
if regionId == project.Name {
|
||||
self.isMainProject = true
|
||||
if project.Name == region.ID {
|
||||
self.isMainProject = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
filtedRegions = self.regions
|
||||
}
|
||||
|
||||
if len(filtedRegions) == 0 {
|
||||
return errors.Wrapf(cloudprovider.ErrNotFound, "empty regions")
|
||||
}
|
||||
|
||||
self.iregions = make([]cloudprovider.ICloudRegion, len(filtedRegions))
|
||||
for i := 0; i < len(filtedRegions); i += 1 {
|
||||
filtedRegions[i].client = self
|
||||
|
||||
@@ -74,9 +74,8 @@ func (self *SRegion) getECSClient() (*client.Client, error) {
|
||||
}
|
||||
|
||||
regionId := strings.Split(project.Name, "_")[0]
|
||||
if regionId != self.ID {
|
||||
// log.Debugf("project %s not in region %s", self.client.projectId, self.ID)
|
||||
return nil, errors.Error("region and project mismatch")
|
||||
if regionId != self.ID && project.Name != self.ID {
|
||||
return nil, errors.Errorf("region %s and project %s mismatch", self.ID, project.Name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user