From 61c52e6cb5c1b2e50467ef2ccd48172d32394417 Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Wed, 22 Apr 2020 18:52:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=BD=AC=E6=8D=A2=E9=9D=9E=E6=A0=87?= =?UTF-8?q?=E5=87=86=E5=AD=98=E5=82=A8=E7=B1=BB=E5=9E=8B=E5=88=B0lrs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/multicloud/azure/instance.go | 4 ++++ pkg/multicloud/azure/storage.go | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/multicloud/azure/instance.go b/pkg/multicloud/azure/instance.go index 71447e9f3e..1de61add6d 100644 --- a/pkg/multicloud/azure/instance.go +++ b/pkg/multicloud/azure/instance.go @@ -24,6 +24,7 @@ import ( "yunion.io/x/log" "yunion.io/x/pkg/errors" "yunion.io/x/pkg/util/osprofile" + "yunion.io/x/pkg/utils" billing_api "yunion.io/x/onecloud/pkg/apis/billing" api "yunion.io/x/onecloud/pkg/apis/compute" @@ -358,6 +359,9 @@ func (self *SInstance) getStorageInfoByUri(uri string) (*SStorage, *SClassicStor zone: self.host.zone, storageType: storageaccounts[i].Sku.Name, } + if !utils.IsInStringArray(storage.storageType, STORAGETYPES) { + storage.storageType = STORAGE_STD_LRS + } return &storage, nil, nil } } diff --git a/pkg/multicloud/azure/storage.go b/pkg/multicloud/azure/storage.go index f8856fcce0..c5b9458715 100644 --- a/pkg/multicloud/azure/storage.go +++ b/pkg/multicloud/azure/storage.go @@ -30,7 +30,13 @@ type Capabilitie struct { Value string } -var STORAGETYPES = []string{"Standard_LRS", "Premium_LRS", "StandardSSD_LRS"} +const ( + STORAGE_STD_LRS = "Standard_LRS" + STORAGE_PRE_LRS = "Premium_LRS" + STORAGE_STD_SSD = "StandardSSD_LRS" +) + +var STORAGETYPES = []string{STORAGE_STD_LRS, STORAGE_PRE_LRS, STORAGE_STD_SSD} type SStorage struct { zone *SZone