add more sku support for azure disk

add error msg

update bazel
This commit is contained in:
andyzhangx
2018-08-16 08:59:26 +00:00
parent dbe3b1a3b3
commit aa4594ffae
3 changed files with 61 additions and 5 deletions

View File

@@ -59,8 +59,6 @@ var (
string(api.AzureSharedBlobDisk),
string(api.AzureDedicatedBlobDisk),
string(api.AzureManagedDisk))
supportedStorageAccountTypes = sets.NewString("Premium_LRS", "Standard_LRS", "Standard_GRS", "Standard_RAGRS")
)
func getPath(uid types.UID, volName string, host volume.VolumeHost) string {
@@ -127,11 +125,15 @@ func normalizeStorageAccountType(storageAccountType string) (storage.SkuName, er
return defaultStorageAccountType, nil
}
if !supportedStorageAccountTypes.Has(storageAccountType) {
return "", fmt.Errorf("azureDisk - %s is not supported sku/storageaccounttype. Supported values are %s", storageAccountType, supportedStorageAccountTypes.List())
sku := storage.SkuName(storageAccountType)
supportedSkuNames := storage.PossibleSkuNameValues()
for _, s := range supportedSkuNames {
if sku == s {
return sku, nil
}
}
return storage.SkuName(storageAccountType), nil
return "", fmt.Errorf("azureDisk - %s is not supported sku/storageaccounttype. Supported values are %s", storageAccountType, supportedSkuNames)
}
func normalizeCachingMode(cachingMode v1.AzureDataDiskCachingMode) (v1.AzureDataDiskCachingMode, error) {