Merge pull request #8792 from rainzm/esxi/storagetype

feat(esxi): use more specific storage types
This commit is contained in:
Zexi Li
2020-11-19 11:52:24 +08:00
committed by GitHub
2 changed files with 12 additions and 6 deletions
+4 -3
View File
@@ -28,6 +28,7 @@ const (
STORAGE_VSAN = "vsan"
STORAGE_NFS = "nfs"
STORAGE_GPFS = "gpfs"
STORAGE_CIFS = "cifs"
STORAGE_PUBLIC_CLOUD = "cloud"
STORAGE_CLOUD_EFFICIENCY = "cloud_efficiency"
@@ -116,7 +117,7 @@ var (
STORAGE_ALL_TYPES = []string{
STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_SHEEPDOG,
STORAGE_RBD, STORAGE_DOCKER, STORAGE_NAS, STORAGE_VSAN,
STORAGE_NFS, STORAGE_GPFS,
STORAGE_NFS, STORAGE_GPFS, STORAGE_CIFS,
}
STORAGE_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_SHEEPDOG,
STORAGE_RBD, STORAGE_DOCKER, STORAGE_NAS, STORAGE_VSAN, STORAGE_NFS,
@@ -128,12 +129,12 @@ var (
STORAGE_HUAWEI_SSD, STORAGE_HUAWEI_SAS, STORAGE_HUAWEI_SATA,
STORAGE_OPENSTACK_ISCSI, STORAGE_UCLOUD_CLOUD_NORMAL, STORAGE_UCLOUD_CLOUD_SSD,
STORAGE_UCLOUD_LOCAL_NORMAL, STORAGE_UCLOUD_LOCAL_SSD, STORAGE_UCLOUD_EXCLUSIVE_LOCAL_DISK,
STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_ZSTACK_CEPH, STORAGE_GPFS,
STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_ZSTACK_CEPH, STORAGE_GPFS, STORAGE_CIFS,
}
HOST_STORAGE_LOCAL_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_OPENSTACK_NOVA}
STORAGE_LIMITED_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_NAS, STORAGE_RBD, STORAGE_NFS, STORAGE_GPFS}
STORAGE_LIMITED_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_NAS, STORAGE_RBD, STORAGE_NFS, STORAGE_GPFS, STORAGE_VSAN, STORAGE_CIFS}
SHARED_FILE_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS}
FIEL_STORAGE = []string{STORAGE_LOCAL, STORAGE_NFS, STORAGE_GPFS}
+8 -3
View File
@@ -389,15 +389,20 @@ func (self *SDatastore) isLocalVMFS() bool {
func (self *SDatastore) GetStorageType() string {
moStore := self.getDatastore()
switch strings.ToLower(moStore.Summary.Type) {
t := strings.ToLower(moStore.Summary.Type)
switch t {
case "vmfs":
if self.isLocalVMFS() {
return api.STORAGE_LOCAL
} else {
return api.STORAGE_NAS
}
case "nfs", "nfs41", "cifs", "vsan":
return api.STORAGE_NAS
case "nfs", "nfs41":
return api.STORAGE_NFS
case "vsan":
return api.STORAGE_VSAN
case "cifs":
return api.STORAGE_CIFS
default:
log.Fatalf("unsupported datastore type %s", moStore.Summary.Type)
return ""