Skip to content

Commit

Permalink
fix: 转换非标准存储类型到lrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu Xuan committed Apr 22, 2020
1 parent e55bb82 commit 0f2e997
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/multicloud/azure/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
}
Expand Down
8 changes: 7 additions & 1 deletion pkg/multicloud/azure/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0f2e997

Please sign in to comment.