From bb6af1e222f5b5415f7e8e00947efca24629c99f Mon Sep 17 00:00:00 2001 From: rainzm Date: Fri, 13 Nov 2020 15:30:03 +0800 Subject: [PATCH] feat(esxi): use more specific storage types Replace 'nas' with some specific types such as 'vsan', 'nfs' and 'cifs'. --- pkg/apis/compute/storage_const.go | 7 ++++--- pkg/multicloud/esxi/storage.go | 11 ++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/apis/compute/storage_const.go b/pkg/apis/compute/storage_const.go index 5668d8a665..5a6e95067b 100644 --- a/pkg/apis/compute/storage_const.go +++ b/pkg/apis/compute/storage_const.go @@ -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} diff --git a/pkg/multicloud/esxi/storage.go b/pkg/multicloud/esxi/storage.go index a7d7c22528..7e7cc9358a 100644 --- a/pkg/multicloud/esxi/storage.go +++ b/pkg/multicloud/esxi/storage.go @@ -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 ""