From 37519b64e121992e0c8f268704c7ca292cdfa4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Thu, 14 Mar 2019 15:05:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85azure=20city=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/util/azure/geographicinfo.go | 43 ++++++++++++++++++++++++++++++++ pkg/util/azure/region.go | 3 +++ 2 files changed, 46 insertions(+) create mode 100644 pkg/util/azure/geographicinfo.go diff --git a/pkg/util/azure/geographicinfo.go b/pkg/util/azure/geographicinfo.go new file mode 100644 index 0000000000..331f98b118 --- /dev/null +++ b/pkg/util/azure/geographicinfo.go @@ -0,0 +1,43 @@ +package azure + +import "yunion.io/x/onecloud/pkg/cloudprovider" + +var AzureGeographicInfo = map[string]cloudprovider.SGeographicInfo{ + "southafricanorth": {City: "Pretoria", CountryCode: "ZA"}, //比勒陀利亚, 南非 + "southafricawest": {City: "Cape Town", CountryCode: "ZA"}, //开普敦 南非 + "australiacentral2": {City: "Yarralumla", CountryCode: "AU"}, //亚拉伦拉 澳大利亚 + "koreasouth": {City: "Busan", CountryCode: "KR"}, //釜山 韩国 + "canadacentral": {City: "Toronto", CountryCode: "CA"}, //加拿大 多伦多 + "northeurope": {City: "Dublin", CountryCode: "IE"}, //都柏林 爱尔兰 + "australiacentral": {City: "Yarralumla", CountryCode: "AU"}, //亚拉伦拉 澳大利亚 + "francecentral": {City: "Allier", CountryCode: "FR"}, //阿利埃河 法国 + "westus": {City: "San Francisco", CountryCode: "US"}, //旧金山 美国 + "japanwest": {City: "Osaka", CountryCode: "JP"}, //大阪市 日本 + "francesouth": {City: "Tarn", CountryCode: "FR"}, //塔恩 法国 + "eastus": {City: "Virginia", CountryCode: "US"}, // 美国 弗吉尼亚 + "westindia": {City: "Mumbai", CountryCode: "IN"}, //印度 孟买 + "westcentralus": {City: "Utah", CountryCode: "US"}, //美国 犹他州 + "southeastasia": {City: "Singapore", CountryCode: "SG"}, //新加坡 + "eastasia": {City: "HongKong", CountryCode: "CN"}, + "eastus2": {City: "Virginia", CountryCode: "US"}, // 美国 弗吉尼亚 + "japaneast": {City: "Tokyo", CountryCode: "JP"}, // 日本 东京 + "ukwest": {City: "Halton", CountryCode: "GB"}, //英国 哈尔顿 + "australiasoutheast": {City: "Melbourne", CountryCode: "AU"}, // 澳大利亚 墨尔本 + "uksouth": {City: "West Sussex", CountryCode: "GB"}, //英国 西苏塞克斯 + "westus2": {City: "Washington", CountryCode: "US"}, //美国 华盛顿 + "southcentralus": {City: "Texas", CountryCode: "US"}, //美国 德克萨斯 + "brazilsouth": {City: "Sao Paulo", CountryCode: ""}, //巴西 圣保罗 + "koreacentral": {City: "Seoul", CountryCode: "KR"}, //韩国 汉城 + "centralindia": {City: "Maharashtra", CountryCode: "IN"}, //印度 马哈拉施特拉邦 + "northcentralus": {City: "Chicago", CountryCode: "US"}, //美国 芝加哥 + "centralus": {City: "Iowa", CountryCode: "US"}, //美国 爱荷华 + "australiaeast": {City: "Sydney", CountryCode: "AU"}, //澳大利亚 悉尼 + "westeurope": {City: "Holland", CountryCode: "NL"}, //荷兰 + "canadaeast": {City: "Quebec", CountryCode: "CA"}, //加拿大 魁北克市 + "southindia": {City: "Kanchipuram", CountryCode: "IN"}, //印度 甘吉布勒姆 + + "chinaeast": {City: "Shanghai", CountryCode: "CN"}, + "chinaeast2": {City: "Shanghai", CountryCode: "CN"}, + "chinanorth": {City: "Beijing", CountryCode: "CN"}, + "chinanorth2": {City: "Beijing", CountryCode: "CN"}, +} diff --git a/pkg/util/azure/region.go b/pkg/util/azure/region.go index 3eef898d28..b35f283f23 100644 --- a/pkg/util/azure/region.go +++ b/pkg/util/azure/region.go @@ -120,6 +120,9 @@ func (self *SRegion) GetProvider() string { func (self *SRegion) GetGeographicInfo() cloudprovider.SGeographicInfo { info := cloudprovider.SGeographicInfo{} + if geographicInfo, ok := AzureGeographicInfo[self.Name]; ok { + info = geographicInfo + } info.Latitude = self.Latitude info.Longitude = self.Longitude return info