diff --git a/pkg/apis/compute/cloudregions_const.go b/pkg/apis/compute/cloudregions_const.go index 96f693e7fd..97e910c59c 100644 --- a/pkg/apis/compute/cloudregions_const.go +++ b/pkg/apis/compute/cloudregions_const.go @@ -115,8 +115,9 @@ const ( CITY_HOLLAND = "Holland" //荷兰 // 南非 - CITY_PRETORIA = "Pretoria" //比勒陀利亚 - CITY_CAPE_TOWN = "Cape Town" //开普敦 + CITY_PRETORIA = "Pretoria" //比勒陀利亚 + CITY_CAPE_TOWN = "Cape Town" //开普敦 + CITY_JOHANNESBURG = "Johannesburg" //约翰内斯堡 // 泰国 CITY_BANGKOK = "Bangkok" //曼谷 diff --git a/pkg/compute/models/cloudregions.go b/pkg/compute/models/cloudregions.go index 0383f7ba71..867b631173 100644 --- a/pkg/compute/models/cloudregions.go +++ b/pkg/compute/models/cloudregions.go @@ -679,6 +679,12 @@ func (manager *SCloudregionManager) ListItemFilter(ctx context.Context, q *sqlch break } } + + cityStr, _ := query.GetString("city") + if cityStr == "Other" { + q = q.IsNullOrEmpty("city") + query.(*jsonutils.JSONDict).Remove("city") + } return q, nil } diff --git a/pkg/mcclient/modules/mod_cloudregions.go b/pkg/mcclient/modules/mod_cloudregions.go index 3326eccacb..bb9dcf0b7d 100644 --- a/pkg/mcclient/modules/mod_cloudregions.go +++ b/pkg/mcclient/modules/mod_cloudregions.go @@ -59,6 +59,9 @@ func (this *SCloudregionManager) getRegionAttributeList(session *mcclient.Client cities := make(map[string]int) for i := range listResult.Data { cityStr, _ := listResult.Data[i].GetString(attr) + if len(cityStr) == 0 && attr == "city" { + cityStr = "Other" + } if len(cityStr) > 0 { if _, ok := cities[cityStr]; ok { cities[cityStr] += 1 diff --git a/pkg/multicloud/huawei/latitud_and_longitude.go b/pkg/multicloud/huawei/latitud_and_longitude.go index c8c43f21d0..9cab6fd2cc 100644 --- a/pkg/multicloud/huawei/latitud_and_longitude.go +++ b/pkg/multicloud/huawei/latitud_and_longitude.go @@ -24,6 +24,7 @@ import ( // ref: https://countrycode.org var LatitudeAndLongitude = map[string]cloudprovider.SGeographicInfo{ "cn-east-2": {Latitude: 31.210344, Longitude: 121.455364, City: api.CITY_SHANG_HAI, CountryCode: api.COUNTRY_CODE_CN}, + "cn-east-3": {Latitude: 31.210344, Longitude: 121.455364, City: api.CITY_SHANG_HAI, CountryCode: api.COUNTRY_CODE_CN}, "cn-north-1": {Latitude: 39.997743, Longitude: 116.304542, City: api.CITY_BEI_JING, CountryCode: api.COUNTRY_CODE_CN}, "cn-north-4": {Latitude: 39.997743, Longitude: 116.304542, City: api.CITY_BEI_JING, CountryCode: api.COUNTRY_CODE_CN}, "cn-south-1": {Latitude: 23.12911, Longitude: 113.264385, City: api.CITY_GUANG_ZHOU, CountryCode: api.COUNTRY_CODE_CN}, @@ -34,4 +35,5 @@ var LatitudeAndLongitude = map[string]cloudprovider.SGeographicInfo{ "eu-west-0": {Latitude: 48.856614, Longitude: 2.3522219, City: api.CITY_PARIS, CountryCode: api.COUNTRY_CODE_FR}, "cn-northeast-1": {Latitude: 38.91400300000001, Longitude: 121.614682, City: api.CITY_SHANG_HAI, CountryCode: api.COUNTRY_CODE_CN}, "cn-southwest-2": {Latitude: 26.6470035286, Longitude: 106.6302113880, City: api.CITY_GUI_YANG, CountryCode: api.COUNTRY_CODE_CN}, + "af-south-1": {Latitude: -26.1714537, Longitude: 27.8999389, City: api.CITY_JOHANNESBURG, CountryCode: api.COUNTRY_CODE_ZA}, }