fix: 转换非标准存储类型到lrs

This commit is contained in:
Qu Xuan
2020-04-22 18:52:35 +08:00
parent e55bb827a1
commit 0f2e997f6d
2 changed files with 11 additions and 1 deletions
+4
View File
@@ -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
}
}
+7 -1
View File
@@ -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