Merge pull request #8904 from ioito/hotfix/qx-azure-host-storage

fix(region): azure host with storage
This commit is contained in:
Zexi Li
2020-11-23 16:46:17 +08:00
committed by GitHub
2 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -252,7 +252,7 @@ func (self *SHost) GetSysInfo() jsonutils.JSONObject {
}
func (self *SHost) GetIStorages() ([]cloudprovider.ICloudStorage, error) {
return self.zone.istorages, nil
return self.zone.getIStorages(), nil
}
func (self *SHost) GetIVMById(instanceId string) (cloudprovider.ICloudVM, error) {
+7 -7
View File
@@ -26,12 +26,7 @@ type SZone struct {
multicloud.SResourceBase
region *SRegion
istorages []cloudprovider.ICloudStorage
iclassicStorages []cloudprovider.ICloudStorage
storageTypes []string
classicStorageTypes []string
Name string
Name string
}
func (self *SZone) GetId() string {
@@ -98,13 +93,18 @@ func (self *SZone) GetIClassicStorages() []cloudprovider.ICloudStorage {
return ret
}
func (self *SZone) GetIStorages() ([]cloudprovider.ICloudStorage, error) {
func (self *SZone) getIStorages() []cloudprovider.ICloudStorage {
ret := []cloudprovider.ICloudStorage{}
storages := self.ListStorageTypes()
for i := range storages {
storages[i].zone = self
ret = append(ret, &storages[i])
}
return ret
}
func (self *SZone) GetIStorages() ([]cloudprovider.ICloudStorage, error) {
ret := self.getIStorages()
ret = append(ret, self.GetIClassicStorages()...)
return ret, nil
}