| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313 |
- // Copyright 2019 Yunion
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- package compute
- import (
- "yunion.io/x/cloudmux/pkg/apis/compute"
- "yunion.io/x/onecloud/pkg/apis"
- )
- const (
- STORAGE_LOCAL = compute.STORAGE_LOCAL
- STORAGE_BAREMETAL = "baremetal"
- STORAGE_SHEEPDOG = "sheepdog"
- STORAGE_RBD = compute.STORAGE_RBD
- STORAGE_DOCKER = "docker"
- STORAGE_NAS = compute.STORAGE_NAS
- STORAGE_VSAN = "vsan"
- STORAGE_NFS = compute.STORAGE_NFS
- STORAGE_GPFS = "gpfs"
- STORAGE_CIFS = compute.STORAGE_CIFS
- STORAGE_NVME_PT = "nvme_pt" // nvme passthrough
- STORAGE_NVME = "nvme" // nvme sriov
- STORAGE_LVM = "lvm"
- STORAGE_CLVM = "clvm" // clustered lvm
- STORAGE_SLVM = "slvm" // shared lvm
- STORAGE_PUBLIC_CLOUD = compute.STORAGE_PUBLIC_CLOUD
- STORAGE_CLOUD_EFFICIENCY = compute.STORAGE_CLOUD_EFFICIENCY
- STORAGE_CLOUD_SSD = compute.STORAGE_CLOUD_SSD
- STORAGE_CLOUD_ESSD_PL0 = compute.STORAGE_CLOUD_ESSD_PL0 // 增强型(Enhanced)SSD 云盘, 单盘最高随机读写IOPS 1万
- STORAGE_CLOUD_ESSD = compute.STORAGE_CLOUD_ESSD // 增强型(Enhanced)SSD 云盘, 单盘最高随机读写IOPS 5万
- STORAGE_CLOUD_ESSD_PL2 = compute.STORAGE_CLOUD_ESSD_PL2 // 单盘最高随机读写IOPS 10万
- STORAGE_CLOUD_ESSD_PL3 = compute.STORAGE_CLOUD_ESSD_PL3 // 单盘最高随机读写IOPS 100万
- STORAGE_CLOUD_AUTO = compute.STORAGE_CLOUD_AUTO // ESSD AutoPL
- STORAGE_CLOUD_ESSD_ENTRY = "cloud_essd_entry" // ESSD Entry云盘
- STORAGE_EPHEMERAL_SSD = compute.STORAGE_EPHEMERAL_SSD // 单块本地SSD盘, 容量最大不能超过800 GiB
- STORAGE_LOCAL_HDD_PRO = compute.STORAGE_LOCAL_HDD_PRO // 实例规格族d1ne和d1搭载的SATA HDD本地盘
- STORAGE_LOCAL_SSD_PRO = compute.STORAGE_LOCAL_SSD_PRO // 实例规格族i2、i2g、i1、ga1和gn5等搭载的NVMe
- //Azure hdd and ssd storagetype
- STORAGE_STANDARD_LRS = compute.STORAGE_STANDARD_LRS
- STORAGE_STANDARDSSD_LRS = compute.STORAGE_STANDARDSSD_LRS
- STORAGE_PREMIUM_LRS = compute.STORAGE_PREMIUM_LRS
- STORAGE_AZURE_BASIC = compute.STORAGE_AZURE_BASIC
- STORAGE_AZURE_GENERAL_PURPOSE = compute.STORAGE_AZURE_GENERAL_PURPOSE
- // aws storage type
- STORAGE_GP2_SSD = compute.STORAGE_GP2_SSD // aws general purpose ssd
- STORAGE_GP3_SSD = compute.STORAGE_GP3_SSD // aws General Purpose SSD (gp3)
- STORAGE_IO1_SSD = compute.STORAGE_IO1_SSD // aws Provisioned IOPS SSD
- STORAGE_IO2_SSD = compute.STORAGE_IO2_SSD // aws Provisioned IOPS 2 SSD
- STORAGE_ST1_HDD = compute.STORAGE_ST1_HDD // aws Throughput Optimized HDD
- STORAGE_SC1_HDD = compute.STORAGE_SC1_HDD // aws Cold HDD
- STORAGE_STANDARD_HDD = compute.STORAGE_STANDARD_HDD // aws Magnetic volumes
- // qcloud storage type
- // STORAGE_CLOUD_SSD ="cloud_ssd"
- STORAGE_LOCAL_BASIC = compute.STORAGE_LOCAL_BASIC
- STORAGE_LOCAL_SSD = compute.STORAGE_LOCAL_SSD
- STORAGE_LOCAL_PRO = compute.STORAGE_LOCAL_PRO
- STORAGE_CLOUD_BASIC = compute.STORAGE_CLOUD_BASIC
- STORAGE_CLOUD_PREMIUM = compute.STORAGE_CLOUD_PREMIUM //高性能云硬盘
- STORAGE_CLOUD_HSSD = compute.STORAGE_CLOUD_HSSD //增强型SSD云硬盘
- STORAGE_CLOUD_BSSD = compute.STORAGE_CLOUD_BSSD //增强型SSD云硬盘
- STORAGE_CLOUD_TSSD = compute.STORAGE_CLOUD_TSSD //极速型SSD云硬盘
- // huawei storage type
- STORAGE_HUAWEI_SSD = compute.STORAGE_HUAWEI_SSD // 超高IO云硬盘
- STORAGE_HUAWEI_SAS = compute.STORAGE_HUAWEI_SAS // 高IO云硬盘
- STORAGE_HUAWEI_SATA = compute.STORAGE_HUAWEI_SATA // 普通IO云硬盘
- STORAGE_HUAWEI_GPSSD = compute.STORAGE_HUAWEI_GPSSD // 通用型SSD
- STORAGE_HUAWEI_ESSD = compute.STORAGE_HUAWEI_ESSD // 急速型SSD
- // openstack
- STORAGE_OPENSTACK_ISCSI = compute.STORAGE_OPENSTACK_ISCSI
- STORAGE_OPENSTACK_NOVA = compute.STORAGE_OPENSTACK_NOVA
- // Ucloud storage type
- STORAGE_UCLOUD_CLOUD_NORMAL = compute.STORAGE_UCLOUD_CLOUD_NORMAL // 普通云盘
- STORAGE_UCLOUD_CLOUD_SSD = compute.STORAGE_UCLOUD_CLOUD_SSD // SSD云盘
- STORAGE_UCLOUD_LOCAL_NORMAL = compute.STORAGE_UCLOUD_LOCAL_NORMAL // 普通本地盘
- STORAGE_UCLOUD_LOCAL_SSD = compute.STORAGE_UCLOUD_LOCAL_SSD // SSD本地盘
- STORAGE_UCLOUD_EXCLUSIVE_LOCAL_DISK = compute.STORAGE_UCLOUD_EXCLUSIVE_LOCAL_DISK // 独享本地盘
- // VolcEngine storage types
- STORAGE_VOLC_CLOUD_FLEXPL = compute.STORAGE_VOLCENGINE_FlexPL // 极速型SSD云盘, FlexPL规格
- STORAGE_VOLC_CLOUD_PL0 = compute.STORAGE_VOLCENGINE_PL0 //极速型SSD云盘, PL0规格
- STORAGE_VOLC_CLOUD_PTSSD = compute.STORAGE_VOLCENGINE_PTSSD // 性能型SSD, 上一代产品
- // Zstack storage type
- STORAGE_ZSTACK_LOCAL_STORAGE = compute.STORAGE_ZSTACK_LOCAL_STORAGE
- STORAGE_ZSTACK_CEPH = compute.STORAGE_ZSTACK_CEPH
- STORAGE_ZSTACK_SHARED_BLOCK = compute.STORAGE_ZSTACK_SHARED_BLOCK
- // Google storage type
- STORAGE_GOOGLE_LOCAL_SSD = compute.STORAGE_GOOGLE_LOCAL_SSD //本地SSD暂存盘 (最多8个)
- STORAGE_GOOGLE_PD_STANDARD = compute.STORAGE_GOOGLE_PD_STANDARD //标准永久性磁盘
- STORAGE_GOOGLE_PD_SSD = compute.STORAGE_GOOGLE_PD_SSD //SSD永久性磁盘
- STORAGE_GOOGLE_PD_BALANCED = compute.STORAGE_GOOGLE_PD_BALANCED //平衡永久性磁盘
- STORAGE_GOOGLE_PD_EXTREME = compute.STORAGE_GOOGLE_PD_EXTREME //极端永久性磁盘
- STORAGE_GOOGLE_HYPERDISK_BALANCED = compute.STORAGE_GOOGLE_HYPERDISK_BALANCED //平衡 Hyperdisk
- STORAGE_GOOGLE_HYPERDISK_EXTREME = compute.STORAGE_GOOGLE_HYPERDISK_EXTREME //Hyperdisk Extreme
- STORAGE_GOOGLE_HYPERDISK_THROUGHPUT = compute.STORAGE_GOOGLE_HYPERDISK_THROUGHPUT //Hyperdisk Throughput
- STORAGE_GOOGLE_HYPERDISK_ML = compute.STORAGE_GOOGLE_HYPERDISK_ML //Hyperdisk ML
- // ctyun storage type
- STORAGE_CTYUN_SSD = compute.STORAGE_CTYUN_SSD // 超高IO云硬盘
- STORAGE_CTYUN_SAS = compute.STORAGE_CTYUN_SAS // 高IO云硬盘
- STORAGE_CTYUN_SATA = compute.STORAGE_CTYUN_SATA // 普通IO云硬盘
- // jd cloud storage type
- STORAGE_JDCLOUD_GP1 = compute.STORAGE_JDCLOUD_GP1 // 通用型SSD云硬盘
- STORAGE_JDCLOUD_IO1 = compute.STORAGE_JDCLOUD_IO1 // 性能型SSD云硬盘
- STORAGE_JDCLOUD_STD = compute.STORAGE_JDCLOUD_STD // 容量型HDD云硬盘
- STORAGE_JDCLOUD_SSD = compute.STORAGE_JDCLOUD_SSD // SSD云硬盘
- STORAGE_JDCLOUD_PHD = compute.STORAGE_JDCLOUD_PHD // HDD云硬盘
- STORAGE_ECLOUD_CAPEBS = compute.STORAGE_ECLOUD_CAPEBS // 容量盘
- STORAGE_ECLOUD_EBS = compute.STORAGE_ECLOUD_EBS // 性能盘
- STORAGE_ECLOUD_SSD = compute.STORAGE_ECLOUD_SSD // 高性能盘
- STORAGE_ECLOUD_SSDEBS = compute.STORAGE_ECLOUD_SSDEBS // 性能优化盘
- STORAGE_ECLOUD_SYSTEM = compute.STORAGE_ECLOUD_SYSTEM // 系统盘
- STORAGE_BAIDU_SSD = compute.STORAGE_BAIDU_SSD
- STORAGE_BAIDU_PREMIUM_SSD = compute.STORAGE_BAIDU_PREMIUM_SSD
- STORAGE_BAIDU_HDD = compute.STORAGE_BAIDU_HDD
- STORAGE_BAIDU_ENHANCED_SSD_PL1 = compute.STORAGE_BAIDU_ENHANCED_SSD_PL1
- STORAGE_BAIDU_ENHANCED_SSD_PL2 = compute.STORAGE_BAIDU_ENHANCED_SSD_PL2
- STORAGE_BAIDU_ENHANCED_SSD_PL3 = compute.STORAGE_BAIDU_ENHANCED_SSD_PL3
- // ksyun storage type
- STORAGE_KSYUN_ESSD_AUTO_PL = compute.STORAGE_KSYUN_ESSD_AUTO_PL
- STORAGE_KSYUN_SSD3_0 = compute.STORAGE_KSYUN_SSD3_0
- STORAGE_KSYUN_EHDD = compute.STORAGE_KSYUN_EHDD
- STORAGE_KSYUN_ESSD_PL1 = compute.STORAGE_KSYUN_ESSD_PL1
- STORAGE_KSYUN_ESSD_PL2 = compute.STORAGE_KSYUN_ESSD_PL2
- STORAGE_KSYUN_ESSD_PL3 = compute.STORAGE_KSYUN_ESSD_PL3
- // zettakit
- STORAGE_ZETTAKIT_NORMAL = compute.STORAGE_ZETTAKIT_NORMAL
- // cnware storage type
- STORAGE_CNWARE_FCSAN = compute.STORAGE_CNWARE_FC_SAN
- STORAGE_CNWARE_IPSAN = compute.STORAGE_CNWARE_IP_SAN
- STORAGE_CNWARE_NAS = compute.STORAGE_CNWARE_NAS
- STORAGE_CNWARE_CEPH = compute.STORAGE_CNWARE_CEPH
- STORAGE_CNWARE_LOCAL = compute.STORAGE_CNWARE_LOCAL
- STORAGE_CNWARE_NVME = compute.STORAGE_CNWARE_NVME
- )
- const (
- STORAGE_ENABLED = "enabled"
- // STORAGE_DISABLED = "disabled"
- STORAGE_OFFLINE = compute.STORAGE_OFFLINE // 离线
- STORAGE_ONLINE = compute.STORAGE_ONLINE // 在线
- STORAGE_UNMOUNT = "unmount" // 待挂载
- DISK_TYPE_ROTATE = compute.DISK_TYPE_ROTATE
- DISK_TYPE_SSD = compute.DISK_TYPE_SSD
- DISK_TYPE_HYBRID = compute.DISK_TYPE_HYBRID
- )
- const (
- RBD_DEFAULT_MON_TIMEOUT = 5 //5 seconds 连接超时时间
- RBD_DEFAULT_OSD_TIMEOUT = 20 * 60 //20 minute 操作超时时间
- RBD_DEFAULT_MOUNT_TIMEOUT = 2 * 60 //CephFS挂载超时时间, 目前未使用
- )
- var (
- DISK_TYPES = []string{DISK_TYPE_ROTATE, DISK_TYPE_SSD, DISK_TYPE_HYBRID}
- STORAGE_LOCAL_TYPES = []string{
- STORAGE_LOCAL, STORAGE_NVME_PT, STORAGE_NVME, STORAGE_LVM,
- STORAGE_BAREMETAL, STORAGE_UCLOUD_LOCAL_NORMAL, STORAGE_UCLOUD_LOCAL_SSD, STORAGE_UCLOUD_EXCLUSIVE_LOCAL_DISK,
- STORAGE_EPHEMERAL_SSD, STORAGE_LOCAL_BASIC, STORAGE_LOCAL_SSD, STORAGE_LOCAL_PRO, STORAGE_OPENSTACK_NOVA,
- STORAGE_ZSTACK_LOCAL_STORAGE, STORAGE_GOOGLE_LOCAL_SSD,
- }
- STORAGE_SUPPORT_TYPES = STORAGE_LOCAL_TYPES
- STORAGE_ALL_TYPES = []string{
- STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_SHEEPDOG,
- STORAGE_RBD, STORAGE_DOCKER, STORAGE_NAS, STORAGE_VSAN,
- STORAGE_NFS, STORAGE_GPFS, STORAGE_CIFS, STORAGE_NVME_PT, STORAGE_NVME, STORAGE_LVM,
- }
- STORAGE_TYPES = []string{STORAGE_LOCAL, STORAGE_BAREMETAL, STORAGE_SHEEPDOG,
- STORAGE_RBD, STORAGE_DOCKER, STORAGE_NAS, STORAGE_VSAN, STORAGE_NFS,
- STORAGE_PUBLIC_CLOUD, STORAGE_CLOUD_SSD, STORAGE_CLOUD_ESSD_PL0, STORAGE_CLOUD_ESSD, STORAGE_CLOUD_ESSD_PL2, STORAGE_CLOUD_ESSD_PL3,
- STORAGE_EPHEMERAL_SSD, STORAGE_CLOUD_EFFICIENCY,
- STORAGE_STANDARD_LRS, STORAGE_STANDARDSSD_LRS, STORAGE_PREMIUM_LRS,
- STORAGE_GP2_SSD, STORAGE_GP3_SSD, STORAGE_IO1_SSD, STORAGE_ST1_HDD, STORAGE_SC1_HDD, STORAGE_STANDARD_HDD,
- STORAGE_LOCAL_BASIC, STORAGE_LOCAL_SSD, STORAGE_CLOUD_BASIC, STORAGE_CLOUD_PREMIUM,
- 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_ZSTACK_LOCAL_STORAGE, STORAGE_GPFS, STORAGE_CIFS,
- STORAGE_NVME_PT, STORAGE_NVME, STORAGE_LVM, STORAGE_CLVM, STORAGE_SLVM,
- }
- 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_VSAN, STORAGE_CIFS, STORAGE_CLVM, STORAGE_SLVM}
- SHARED_FILE_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS}
- FIEL_STORAGE = []string{STORAGE_LOCAL, STORAGE_NFS, STORAGE_GPFS, STORAGE_LVM, STORAGE_CLVM, STORAGE_SLVM}
- // supported shared storage types
- SHARED_STORAGE = []string{STORAGE_NFS, STORAGE_GPFS, STORAGE_RBD, STORAGE_CLVM, STORAGE_SLVM}
- SUPPORTED_FS = []string{"swap", "ext2", "ext3", "ext4", "xfs", "f2fs"}
- )
- func IsDiskTypeMatch(t1, t2 string) bool {
- switch t1 {
- case DISK_TYPE_ROTATE:
- if t2 == DISK_TYPE_SSD {
- return false
- } else {
- return true
- }
- case DISK_TYPE_SSD:
- if t2 == DISK_TYPE_ROTATE {
- return false
- } else {
- return true
- }
- default:
- return true
- }
- }
- const (
- STORAGE_METADATA_VENDOR = "vendor"
- STORAGE_METADATA_MODEL = "model"
- STORAGE_METADATA_BANDWIDTH = "bandwidth"
- )
- type StorageResourceInput struct {
- // 存储(ID或Name)
- StorageId string `json:"storage_id"`
- // swagger:ignore
- // Deprecated
- // filter by storage_id
- Storage string `json:"storage" yunion-deprecated-by:"storage_id"`
- }
- type StorageFilterListInputBase struct {
- StorageResourceInput
- // 以host过滤
- StorageHostId string `json:"storage_host_id"`
- // 以存储名称排序
- // pattern:asc|desc
- OrderByStorage string `json:"order_by_storage"`
- }
- type StorageFilterListInput struct {
- StorageFilterListInputBase
- StorageShareFilterListInput
- ZonalFilterListInput
- ManagedResourceListInput
- }
- type StorageShareFilterListInput struct {
- // filter shared storage
- Share *bool `json:"share"`
- // filter local storage
- Local *bool `json:"local"`
- }
- type StorageListInput struct {
- apis.EnabledStatusInfrasResourceBaseListInput
- apis.ExternalizedResourceBaseListInput
- SchedtagResourceInput
- ManagedResourceListInput
- ZonalFilterListInput
- UsableResourceListInput
- StorageShareFilterListInput
- // filter by host schedtag
- HostSchedtagId string `json:"host_schedtag_id"`
- // filter by cachedimage
- ImageId string `json:"image_id"`
- // filter storages which attached the specified host
- HostId string `json:"host_id"`
- // filter storages which server can change disks to
- ServerId string `json:"server_id"`
- // filter storages of baremetal host
- IsBaremetal *bool `json:"is_baremetal"`
- // filter by storage type
- StorageType string `json:"storage_type"`
- }
|