From ab07ebe3d94df18f127fb195f0c3b9de39c3c5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Sat, 18 Feb 2023 08:51:12 +0800 Subject: [PATCH] fix(region): vender update for gcp storage (#15980) --- go.mod | 2 +- go.sum | 4 +- pkg/compute/models/cloudprovider_quotas.go | 2 +- vendor/modules.txt | 2 +- .../pkg/apis/compute/cloudregions_const.go | 14 +++++++ .../x/cloudmux/pkg/apis/compute/regiondata.go | 24 +++++++++++ .../google/latitude_and_longitude.go | 42 ++++++++++++------- .../cloudmux/pkg/multicloud/google/storage.go | 5 +++ 8 files changed, 76 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 837c5604c1..7d78230f64 100644 --- a/go.mod +++ b/go.mod @@ -81,7 +81,7 @@ require ( k8s.io/client-go v0.19.3 k8s.io/cluster-bootstrap v0.19.3 moul.io/http2curl/v2 v2.3.0 - yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230216091342-1c576ec91caa + yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230217044210-52661352164d yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656 yunion.io/x/jsonutils v1.0.1-0.20220819091305-3bab322ab4fd yunion.io/x/log v1.0.0 diff --git a/go.sum b/go.sum index 7dd2fc29ad..deb6920165 100644 --- a/go.sum +++ b/go.sum @@ -1158,8 +1158,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230216091342-1c576ec91caa h1:TUYEeZD2HdT9p/zmB8zOuh/98fl7jR1YF8eVTGij9lI= -yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230216091342-1c576ec91caa/go.mod h1:yEMFtIKPyIdIfPzsw7oTcH41JXc8G5StUAQw3ZoGj5I= +yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230217044210-52661352164d h1:5O1nznaWpVVudgt+82cN2ur/ED2GbAVhzlzSuw83z7Q= +yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230217044210-52661352164d/go.mod h1:yEMFtIKPyIdIfPzsw7oTcH41JXc8G5StUAQw3ZoGj5I= yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656 h1:0zlZD5uhZoIHgLVAWCz2aHaYk2ZrNsACCYD7R6EIBII= yunion.io/x/executor v0.0.0-20211018100936-39a2cd966656/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws= yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634= diff --git a/pkg/compute/models/cloudprovider_quotas.go b/pkg/compute/models/cloudprovider_quotas.go index 8cf7370c1a..8e0617aecb 100644 --- a/pkg/compute/models/cloudprovider_quotas.go +++ b/pkg/compute/models/cloudprovider_quotas.go @@ -73,7 +73,7 @@ type SCloudproviderQuota struct { MaxCount int `nullable:"false" default:"0" list:"user"` // 配额类型 - QuotaType string `width:"32" charset:"ascii" list:"user"` + QuotaType string `width:"64" charset:"ascii" list:"user"` } func (manager *SCloudproviderQuotaManager) GetContextManagers() [][]db.IModelManager { diff --git a/vendor/modules.txt b/vendor/modules.txt index 1a898b61c0..2a1bbcc713 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1439,7 +1439,7 @@ sigs.k8s.io/structured-merge-diff/v4/value # sigs.k8s.io/yaml v1.2.0 ## explicit; go 1.12 sigs.k8s.io/yaml -# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230216091342-1c576ec91caa +# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20230217044210-52661352164d ## explicit; go 1.18 yunion.io/x/cloudmux/pkg/apis yunion.io/x/cloudmux/pkg/apis/billing diff --git a/vendor/yunion.io/x/cloudmux/pkg/apis/compute/cloudregions_const.go b/vendor/yunion.io/x/cloudmux/pkg/apis/compute/cloudregions_const.go index 9ea38ce487..df060419e4 100644 --- a/vendor/yunion.io/x/cloudmux/pkg/apis/compute/cloudregions_const.go +++ b/vendor/yunion.io/x/cloudmux/pkg/apis/compute/cloudregions_const.go @@ -126,6 +126,8 @@ const ( CITY_SALT_LAKE_CITY = "Salt Lake City" //盐湖城 CITY_LAS_VEGAS = "Las Vegas" //拉斯维加斯 CITY_PHOENIX = "Phoenix" //菲尼克斯 + CITY_DALLAS = "Dallas" //达拉斯 + CITY_COLUMBUS = "Columbus" //哥伦布 // 英国 CITY_LONDON = "London" //伦敦 @@ -197,6 +199,15 @@ const ( // 越南 CITY_HO_CHI_MINH = "Ho Chi Minh" //??? + // 以色列 + CITY_TEL_AVIV = "Tel Aviv" // 拉斯维夫 + + // 意大利 + CITY_MILAN = "Milan" // 米兰 + + // 西班牙 + CITY_MADRID = "Madrid" // 马德里 + COUNTRY_CODE_CN = "CN" //中国 COUNTRY_CODE_JP = "JP" //日本 COUNTRY_CODE_SG = "SG" //新加坡 @@ -228,4 +239,7 @@ const ( COUNTRY_CODE_PL = "PL" //波兰 COUNTRY_CODE_FI = "FI" //芬兰 COUNTRY_CODE_BE = "BE" //比利时 + COUNTRY_CODE_IL = "IL" //以色列 + COUNTRY_CODE_IT = "IT" //意大利 + COUNTRY_CODE_ES = "ES" //西班牙 ) diff --git a/vendor/yunion.io/x/cloudmux/pkg/apis/compute/regiondata.go b/vendor/yunion.io/x/cloudmux/pkg/apis/compute/regiondata.go index 91ab4c24f3..26deb0b6f5 100644 --- a/vendor/yunion.io/x/cloudmux/pkg/apis/compute/regiondata.go +++ b/vendor/yunion.io/x/cloudmux/pkg/apis/compute/regiondata.go @@ -315,12 +315,24 @@ var ( City: CITY_ZURICH, CountryCode: COUNTRY_CODE_CH, } + RegionMilan = cloudprovider.SGeographicInfo{ + Latitude: 45.4627124, + Longitude: 9.1076929, + City: CITY_MILAN, + CountryCode: COUNTRY_CODE_IT, + } RegionWarsaw = cloudprovider.SGeographicInfo{ Latitude: 52.233333, Longitude: 21.016667, City: CITY_WARSAW, CountryCode: COUNTRY_CODE_PL, } + RegionMadrid = cloudprovider.SGeographicInfo{ + Latitude: 40.4378698, + Longitude: -3.8196188, + City: CITY_MADRID, + CountryCode: COUNTRY_CODE_ES, + } RegionIreland = cloudprovider.SGeographicInfo{ Latitude: 53.41291, Longitude: -8.24389, @@ -534,6 +546,18 @@ var ( City: CITY_LAS_VEGAS, CountryCode: COUNTRY_CODE_US, } + RegionDallas = cloudprovider.SGeographicInfo{ + Latitude: 32.7844251, + Longitude: -96.8913045, + City: CITY_DALLAS, + CountryCode: COUNTRY_CODE_US, + } + RegionColumbus = cloudprovider.SGeographicInfo{ + Latitude: 32.0879267, + Longitude: 34.7622266, + City: CITY_TEL_AVIV, + CountryCode: COUNTRY_CODE_IL, + } RegionNorthCalifornia = cloudprovider.SGeographicInfo{ Latitude: 38.8375215, Longitude: -120.8958242, diff --git a/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/latitude_and_longitude.go b/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/latitude_and_longitude.go index 00de2a6e30..659902414c 100644 --- a/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/latitude_and_longitude.go +++ b/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/latitude_and_longitude.go @@ -32,13 +32,16 @@ var LatitudeAndLongitude = map[string]cloudprovider.SGeographicInfo{ "australia-southeast1": api.RegionSydney, "australia-southeast2": api.RegionMelbourne, - "europe-north1": api.RegionFinland, - "europe-west1": api.RegionBelgium, - "europe-west2": api.RegionLondon, - "europe-west3": api.RegionFrankfurt, - "europe-west4": api.RegionHolland, - "europe-west6": api.RegionZurich, - "europe-central2": api.RegionWarsaw, + "europe-north1": api.RegionFinland, + "europe-west1": api.RegionBelgium, + "europe-west2": api.RegionLondon, + "europe-west3": api.RegionFrankfurt, + "europe-west4": api.RegionHolland, + "europe-west6": api.RegionZurich, + "europe-west8": api.RegionMilan, + "europe-west9": api.RegionParis, + "europe-central2": api.RegionWarsaw, + "europe-southwest1": api.RegionMadrid, "northamerica-northeast1": api.RegionMontreal, "northamerica-northeast2": api.RegionToronto, @@ -46,11 +49,15 @@ var LatitudeAndLongitude = map[string]cloudprovider.SGeographicInfo{ "us-central1": api.RegionIowa, "us-east1": api.RegionCarolina, "us-east4": api.RegionNothVirginia, + "us-east5": api.RegionColumbus, "us-west1": api.RegionOregon, "us-west2": api.RegionLosAngeles, "us-west3": api.RegionSaltLakeCity, "us-west4": api.RegionLasVegas, + "us-south1": api.RegionDallas, "southamerica-west1": api.RegionSantiago, + + "me-west1": api.RegionColumbus, } var RegionNames = map[string]string{ @@ -66,13 +73,16 @@ var RegionNames = map[string]string{ "australia-southeast1": "悉尼", "australia-southeast2": "墨尔本", - "europe-north1": "芬兰", - "europe-west1": "比利时", - "europe-west2": "伦敦", - "europe-west3": "法兰克福", - "europe-west4": "荷兰", - "europe-west6": "苏黎世", - "europe-central2": "华沙", + "europe-north1": "芬兰", + "europe-west1": "比利时", + "europe-west2": "伦敦", + "europe-west3": "法兰克福", + "europe-west4": "荷兰", + "europe-west6": "苏黎世", + "europe-west8": "米兰", + "europe-west9": "巴黎", + "europe-central2": "华沙", + "europe-southwest1": "马德里", "northamerica-northeast1": "蒙特利尔", "northamerica-northeast2": "多伦多", @@ -81,10 +91,14 @@ var RegionNames = map[string]string{ "us-central1": "爱荷华", "us-east1": "南卡罗来纳州", "us-east4": "北弗吉尼亚", + "us-east5": "哥伦布", "us-west1": "俄勒冈州", "us-west2": "洛杉矶", "us-west3": "盐湖城", "us-west4": "拉斯维加斯", + "us-south1": "达拉斯", + + "me-west1": "特拉维夫", // Multi-region "us": "美国的多区域", diff --git a/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/storage.go b/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/storage.go index 3082b8e427..70b14e3427 100644 --- a/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/storage.go +++ b/vendor/yunion.io/x/cloudmux/pkg/multicloud/google/storage.go @@ -16,6 +16,7 @@ package google import ( "fmt" + "strings" "time" "yunion.io/x/jsonutils" @@ -47,6 +48,10 @@ func (region *SRegion) GetStorages(zone string, maxResults int, pageToken string return storages, region.List(resource, params, maxResults, pageToken, &storages) } +func (self *SStorage) GetGlobalId() string { + return strings.TrimPrefix(self.SelfLink, fmt.Sprintf("%s/%s/", GOOGLE_COMPUTE_DOMAIN, GOOGLE_API_VERSION)) +} + func (region *SRegion) GetStorage(id string) (*SStorage, error) { storage := &SStorage{} return storage, region.GetBySelfId(id, storage)