Merge pull request #5218 from rainzm/automated-cherry-pick-of-#5217-upstream-release-3.1

Automated cherry pick of #5217: fix: Storage filter not work for Esxi
This commit is contained in:
Zexi Li
2020-02-21 16:44:38 +08:00
committed by GitHub
2 changed files with 11 additions and 5 deletions
+2
View File
@@ -54,6 +54,8 @@ func (self *SESXiGuestDriver) DoScheduleMemoryFilter() bool { return true }
func (self *SESXiGuestDriver) DoScheduleSKUFilter() bool { return false }
func (self *SESXiGuestDriver) DoScheduleStorageFilter() bool { return true }
func (self *SESXiGuestDriver) GetHypervisor() string {
return api.HYPERVISOR_ESXI
}
+9 -5
View File
@@ -565,12 +565,16 @@ func (self *SHost) getStorages() []*SHostStorageAdapterInfo {
}
func (self *SHost) GetStorageSizeMB() int {
size := 0
storages := self.GetStorageInfo()
for i := 0; i < len(storages); i += 1 {
size += storages[i].Size
storages, err := self.GetIStorages()
if err != nil {
log.Errorf("SHost.GetStorageSizeMB: SHost.GetIStorages: %s", err)
return 0
}
return size
var size int64
for _, stor := range storages {
size += stor.GetCapacityMB()
}
return int(size)
}
func (self *SHost) GetStorageType() string {