Documentation ¶
Index ¶
- Constants
- Variables
- func GetInstanceIdFromFile(filepath string) (instanceId string, err error)
- func IsValidFileSystemType(fs string) bool
- func IsValidReplica(replica int) bool
- func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability
- func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability
- func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability_AccessMode
- type DiskDriver
- func (d *DiskDriver) GetControllerCapability() []*csi.ControllerServiceCapability
- func (d *DiskDriver) GetInstanceId() string
- func (d *DiskDriver) GetMaxVolumePerNode() int64
- func (d *DiskDriver) GetName() string
- func (d *DiskDriver) GetNodeCapability() []*csi.NodeServiceCapability
- func (d *DiskDriver) GetPluginCapability() []*csi.PluginCapability
- func (d *DiskDriver) GetTopologyInstanceTypeKey() string
- func (d *DiskDriver) GetTopologyZoneKey() string
- func (d *DiskDriver) GetVersion() string
- func (d *DiskDriver) GetVolumeCapability() []*csi.VolumeCapability_AccessMode
- func (d *DiskDriver) InitDiskDriver(input *InitDiskDriverInput)
- func (d *DiskDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapability_RPC_Type) bool
- func (d *DiskDriver) ValidateNodeServiceRequest(c csi.NodeServiceCapability_RPC_Type) bool
- func (d *DiskDriver) ValidatePluginCapabilityService(cap csi.PluginCapability_Service_Type) bool
- func (d *DiskDriver) ValidateVolumeAccessMode(c csi.VolumeCapability_AccessMode_Mode) bool
- func (d *DiskDriver) ValidateVolumeCapabilities(caps []*csi.VolumeCapability) bool
- func (d *DiskDriver) ValidateVolumeCapability(cap *csi.VolumeCapability) bool
- type InitDiskDriverInput
- type InstanceType
- type QingSnapshotClass
- type QingStorageClass
- func (sc QingStorageClass) FormatVolumeSizeByte(sizeByte int64) int64
- func (sc QingStorageClass) GetContainerConfID() string
- func (sc QingStorageClass) GetDiskType() VolumeType
- func (sc QingStorageClass) GetFsType() string
- func (sc QingStorageClass) GetMaxSizeByte() int64
- func (sc QingStorageClass) GetMinSizeByte() int64
- func (sc QingStorageClass) GetPlaceGroupID() string
- func (sc QingStorageClass) GetRG() string
- func (sc QingStorageClass) GetReplica() int
- func (sc QingStorageClass) GetRequiredVolumeSizeByte(capRange *csi.CapacityRange) (int64, error)
- func (sc QingStorageClass) GetStepSizeByte() int64
- func (sc QingStorageClass) GetTags() []string
- type Topology
- type VolumeType
Constants ¶
const ( StorageClassTypeName = "type" StorageClassMaxSizeName = "maxSize" StorageClassMinSizeName = "minSize" StorageClassStepSizeName = "stepSize" StorageClassFsTypeName = "fsType" StorageClassReplicaName = "replica" StorageClassTagsName = "tags" StorageClassContainerConfID = "containerConfID" StorageClassRG = "rg" StorageClassPlaceGroupID = "placeGroupID" )
const ( DiskSingleReplicaType int = 1 DiskMultiReplicaType int = 2 DiskThreeReplicaType int = 3 DefaultDiskReplicaType int = DiskMultiReplicaType )
const (
DefaultInstanceIdFilePath = "/etc/qingcloud/instance-id"
)
const (
SnapshotClassTagsName = "tags"
)
Variables ¶
var DefaultControllerServiceCapability = []csi.ControllerServiceCapability_RPC_Type{ csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME, csi.ControllerServiceCapability_RPC_PUBLISH_UNPUBLISH_VOLUME, csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT, csi.ControllerServiceCapability_RPC_EXPAND_VOLUME, csi.ControllerServiceCapability_RPC_CLONE_VOLUME, }
var DefaultNodeServiceCapability = []csi.NodeServiceCapability_RPC_Type{ csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME, csi.NodeServiceCapability_RPC_EXPAND_VOLUME, csi.NodeServiceCapability_RPC_GET_VOLUME_STATS, }
var DefaultPluginCapability = []*csi.PluginCapability{ { Type: &csi.PluginCapability_Service_{ Service: &csi.PluginCapability_Service{ Type: csi.PluginCapability_Service_CONTROLLER_SERVICE, }, }, }, { Type: &csi.PluginCapability_VolumeExpansion_{ VolumeExpansion: &csi.PluginCapability_VolumeExpansion{ Type: csi.PluginCapability_VolumeExpansion_OFFLINE, }, }, }, { Type: &csi.PluginCapability_Service_{ Service: &csi.PluginCapability_Service{ Type: csi.PluginCapability_Service_VOLUME_ACCESSIBILITY_CONSTRAINTS, }, }, }, }
var DefaultVolumeAccessModeType = []csi.VolumeCapability_AccessMode_Mode{ csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, }
var InstanceTypeAttachPreferred = map[InstanceType]VolumeType{ HighPerformanceInstanceType: HighPerformanceVolumeType, SuperHighPerformanceInstanceType: SuperHighPerformanceVolumeType, SANInstanceType: NeonSANVolumeType, SuperHighPerformanceSANInstanceType: NeonSANVolumeType, HighPerformanceSANInstanceType: NeonSANRDMAVolumeType, StandardInstanceType: StandardVolumeType, Enterprise1InstanceType: SSDEnterpriseVolumeType, Enterprise2InstanceType: SSDEnterpriseVolumeType, EnterpriseCompute3InstanceType: SSDEnterpriseVolumeType, PremiumInstanceType: SSDEnterpriseVolumeType, NvidiaAmpereG3InstanceType: NeonSANHDDVolumeType, TPSCInstanceType: ThirdPartyStorageType, TPSC1InstanceType: ThirdPartyStorageType, TPSC2InstanceType: ThirdPartyStorageType, TPSC3InstanceType: ThirdPartyStorageType, TPSC4InstanceType: ThirdPartyStorageType, TPSC5InstanceType: ThirdPartyStorageType, AMDFireProS7150InstanceType: NeonSANHDDVolumeType, }
var InstanceTypeName = map[InstanceType]string{
0: "HighPerformance",
1: "SuperHighPerformance",
3: "SAN",
6: "SuperHighPerformanceSAN",
7: "HighPerformanceSAN",
101: "Standard",
201: "Enterprise1",
202: "Enterprise2",
203: "EnterpriseCompute3",
301: "Premium",
1003: "NvidiaAmpereG3",
400: "TPSC",
401: "TPSC1",
402: "TPSC2",
403: "TPSC3",
404: "TPSC4",
405: "TPSC5",
1002: "AMDFireProS7150",
}
var InstanceTypeValue = map[string]InstanceType{
"HighPerformance": 0,
"SuperHighPerformance": 1,
"SAN": 3,
"SuperHighPerformanceSAN": 6,
"HighPerformanceSAN": 7,
"Standard": 101,
"Enterprise1": 201,
"Enterprise2": 202,
"EnterpriseCompute3": 203,
"Premium": 301,
"NvidiaAmpereG3": 1003,
"TPSC": 400,
"TPSC1": 401,
"TPSC2": 402,
"TPSC3": 403,
"TPSC4": 404,
"TPSC5": 405,
"AMDFireProS7150": 1002,
}
var VolumeTypeAttachConstraint = map[VolumeType][]InstanceType{ HighPerformanceVolumeType: { HighPerformanceInstanceType, StandardInstanceType, }, HighCapacityVolumeType: { HighPerformanceInstanceType, SuperHighPerformanceInstanceType, StandardInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, PremiumInstanceType, NvidiaAmpereG3InstanceType, AMDFireProS7150InstanceType, }, SuperHighPerformanceVolumeType: { SuperHighPerformanceInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, PremiumInstanceType, }, NeonSANVolumeType: { HighPerformanceInstanceType, SuperHighPerformanceInstanceType, SANInstanceType, SuperHighPerformanceSANInstanceType, HighPerformanceSANInstanceType, StandardInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, EnterpriseCompute3InstanceType, PremiumInstanceType, NvidiaAmpereG3InstanceType, AMDFireProS7150InstanceType, }, NeonSANHDDVolumeType: { HighPerformanceInstanceType, SuperHighPerformanceInstanceType, SANInstanceType, SuperHighPerformanceSANInstanceType, HighPerformanceSANInstanceType, StandardInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, EnterpriseCompute3InstanceType, PremiumInstanceType, NvidiaAmpereG3InstanceType, AMDFireProS7150InstanceType, }, NeonSANRDMAVolumeType: { HighPerformanceInstanceType, SuperHighPerformanceInstanceType, SANInstanceType, SuperHighPerformanceSANInstanceType, HighPerformanceSANInstanceType, StandardInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, EnterpriseCompute3InstanceType, PremiumInstanceType, NvidiaAmpereG3InstanceType, AMDFireProS7150InstanceType, }, ThirdPartyStorageType: { StandardInstanceType, TPSCInstanceType, TPSC1InstanceType, TPSC2InstanceType, TPSC3InstanceType, TPSC4InstanceType, TPSC5InstanceType, }, StandardVolumeType: { HighPerformanceInstanceType, StandardInstanceType, }, SSDEnterpriseVolumeType: { SuperHighPerformanceInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, EnterpriseCompute3InstanceType, PremiumInstanceType, }, }
var VolumeTypeName = map[VolumeType]string{ HighPerformanceVolumeType: "HighPerformance", HighCapacityVolumeType: "HighCapacity", SuperHighPerformanceVolumeType: "SuperHighPerformance", NeonSANVolumeType: "NeonSAN", NeonSANHDDVolumeType: "NeonSANHDD", NeonSANRDMAVolumeType: "NeonSANRDMA", ThirdPartyStorageType: "ThirdPartyStorage", StandardVolumeType: "Standard", SSDEnterpriseVolumeType: "SSDEnterprise", }
convert volume type to string https://docs.qingcloud.com/product/api/action/volume/create_volumes.html
var VolumeTypeToMaxSize = map[VolumeType]int{ HighPerformanceVolumeType: 2000, HighCapacityVolumeType: 5000, SuperHighPerformanceVolumeType: 2000, NeonSANVolumeType: 24000, NeonSANHDDVolumeType: 32000, NeonSANRDMAVolumeType: 32000, ThirdPartyStorageType: 200, StandardVolumeType: 2000, SSDEnterpriseVolumeType: 2000, }
var VolumeTypeToMinSize = map[VolumeType]int{ HighPerformanceVolumeType: 20, HighCapacityVolumeType: 20, SuperHighPerformanceVolumeType: 20, NeonSANVolumeType: 20, NeonSANHDDVolumeType: 20, NeonSANRDMAVolumeType: 450, ThirdPartyStorageType: 10, StandardVolumeType: 10, SSDEnterpriseVolumeType: 20, }
var VolumeTypeToStepSize = map[VolumeType]int{ HighPerformanceVolumeType: 10, HighCapacityVolumeType: 10, SuperHighPerformanceVolumeType: 10, NeonSANVolumeType: 10, NeonSANHDDVolumeType: 10, NeonSANRDMAVolumeType: 10, ThirdPartyStorageType: 10, StandardVolumeType: 10, SSDEnterpriseVolumeType: 10, }
Functions ¶
func GetInstanceIdFromFile ¶
GetInstanceIdFromFile gets instance id from specific file path. In QingCloud Linux instance, it stores instance id in /etc/qingcloud/instance-id.
func IsValidFileSystemType ¶
Check file system type Support: ext3, ext4 and xfs
func IsValidReplica ¶
Check replica Support: 2 MultiReplicas, 1 SingleReplica
func NewControllerServiceCapability ¶
func NewControllerServiceCapability(cap csi.ControllerServiceCapability_RPC_Type) *csi.ControllerServiceCapability
NewControllerServiceCapability creates CSI controller capability object.
func NewNodeServiceCapability ¶
func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeServiceCapability
NewNodeServiceCapability creates CSI node capability object.
func NewVolumeCapabilityAccessMode ¶
func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability_AccessMode
NewVolumeCapabilityAccessMode creates CSI volume access mode object.
Types ¶
type DiskDriver ¶
type DiskDriver struct {
// contains filtered or unexported fields
}
func (*DiskDriver) GetControllerCapability ¶
func (d *DiskDriver) GetControllerCapability() []*csi.ControllerServiceCapability
func (*DiskDriver) GetInstanceId ¶
func (d *DiskDriver) GetInstanceId() string
func (*DiskDriver) GetMaxVolumePerNode ¶
func (d *DiskDriver) GetMaxVolumePerNode() int64
func (*DiskDriver) GetName ¶
func (d *DiskDriver) GetName() string
func (*DiskDriver) GetNodeCapability ¶
func (d *DiskDriver) GetNodeCapability() []*csi.NodeServiceCapability
func (*DiskDriver) GetPluginCapability ¶
func (d *DiskDriver) GetPluginCapability() []*csi.PluginCapability
func (*DiskDriver) GetTopologyInstanceTypeKey ¶
func (d *DiskDriver) GetTopologyInstanceTypeKey() string
func (*DiskDriver) GetTopologyZoneKey ¶
func (d *DiskDriver) GetTopologyZoneKey() string
func (*DiskDriver) GetVersion ¶
func (d *DiskDriver) GetVersion() string
func (*DiskDriver) GetVolumeCapability ¶
func (d *DiskDriver) GetVolumeCapability() []*csi.VolumeCapability_AccessMode
func (*DiskDriver) InitDiskDriver ¶
func (d *DiskDriver) InitDiskDriver(input *InitDiskDriverInput)
func (*DiskDriver) ValidateControllerServiceRequest ¶
func (d *DiskDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapability_RPC_Type) bool
func (*DiskDriver) ValidateNodeServiceRequest ¶
func (d *DiskDriver) ValidateNodeServiceRequest(c csi.NodeServiceCapability_RPC_Type) bool
func (*DiskDriver) ValidatePluginCapabilityService ¶
func (d *DiskDriver) ValidatePluginCapabilityService(cap csi.PluginCapability_Service_Type) bool
func (*DiskDriver) ValidateVolumeAccessMode ¶
func (d *DiskDriver) ValidateVolumeAccessMode(c csi.VolumeCapability_AccessMode_Mode) bool
func (*DiskDriver) ValidateVolumeCapabilities ¶
func (d *DiskDriver) ValidateVolumeCapabilities(caps []*csi.VolumeCapability) bool
func (*DiskDriver) ValidateVolumeCapability ¶
func (d *DiskDriver) ValidateVolumeCapability(cap *csi.VolumeCapability) bool
type InitDiskDriverInput ¶
type InitDiskDriverInput struct { Name string Version string NodeId string MaxVolume int64 VolumeCap []csi.VolumeCapability_AccessMode_Mode ControllerCap []csi.ControllerServiceCapability_RPC_Type NodeCap []csi.NodeServiceCapability_RPC_Type PluginCap []*csi.PluginCapability }
type InstanceType ¶
type InstanceType int
const ( HighPerformanceInstanceType InstanceType = 0 SuperHighPerformanceInstanceType InstanceType = 1 SANInstanceType InstanceType = 3 SuperHighPerformanceSANInstanceType InstanceType = 6 HighPerformanceSANInstanceType InstanceType = 7 StandardInstanceType InstanceType = 101 Enterprise1InstanceType InstanceType = 201 Enterprise2InstanceType InstanceType = 202 EnterpriseCompute3InstanceType InstanceType = 203 PremiumInstanceType InstanceType = 301 NvidiaAmpereG3InstanceType InstanceType = 1003 TPSCInstanceType InstanceType = 400 TPSC1InstanceType InstanceType = 401 TPSC2InstanceType InstanceType = 402 TPSC3InstanceType InstanceType = 403 TPSC4InstanceType InstanceType = 404 TPSC5InstanceType InstanceType = 405 AMDFireProS7150InstanceType InstanceType = 1002 )
func (InstanceType) Int ¶
func (i InstanceType) Int() int
func (InstanceType) IsValid ¶
func (i InstanceType) IsValid() bool
type QingSnapshotClass ¶
type QingSnapshotClass struct {
// contains filtered or unexported fields
}
func NewDefaultQingSnapshotClass ¶
func NewDefaultQingSnapshotClass() *QingSnapshotClass
NewDefaultQingSnapshotClass create default QingSnapshotClass object
func NewQingSnapshotClassFromMap ¶
func NewQingSnapshotClassFromMap(opt map[string]string) (*QingSnapshotClass, error)
func (QingSnapshotClass) GetTags ¶
func (sc QingSnapshotClass) GetTags() []string
func (*QingSnapshotClass) SetTags ¶
func (sc *QingSnapshotClass) SetTags(tags []string)
type QingStorageClass ¶
type QingStorageClass struct {
// contains filtered or unexported fields
}
func NewDefaultQingStorageClassFromType ¶
func NewDefaultQingStorageClassFromType(diskType VolumeType) *QingStorageClass
NewDefaultQingStorageClassFromType create default qingStorageClass by specified volume type
func NewQingStorageClassFromMap ¶
func NewQingStorageClassFromMap(opt map[string]string, topology *Topology) (*QingStorageClass, error)
NewQingStorageClassFromMap create qingStorageClass object from map
func (QingStorageClass) FormatVolumeSizeByte ¶
func (sc QingStorageClass) FormatVolumeSizeByte(sizeByte int64) int64
FormatVolumeSize transfer to proper volume size
func (QingStorageClass) GetContainerConfID ¶ added in v1.3.9
func (sc QingStorageClass) GetContainerConfID() string
func (QingStorageClass) GetDiskType ¶
func (sc QingStorageClass) GetDiskType() VolumeType
func (QingStorageClass) GetFsType ¶
func (sc QingStorageClass) GetFsType() string
func (QingStorageClass) GetMaxSizeByte ¶
func (sc QingStorageClass) GetMaxSizeByte() int64
func (QingStorageClass) GetMinSizeByte ¶
func (sc QingStorageClass) GetMinSizeByte() int64
func (QingStorageClass) GetPlaceGroupID ¶ added in v1.4.1
func (sc QingStorageClass) GetPlaceGroupID() string
func (QingStorageClass) GetRG ¶ added in v1.4.0
func (sc QingStorageClass) GetRG() string
func (QingStorageClass) GetReplica ¶
func (sc QingStorageClass) GetReplica() int
func (QingStorageClass) GetRequiredVolumeSizeByte ¶
func (sc QingStorageClass) GetRequiredVolumeSizeByte(capRange *csi.CapacityRange) (int64, error)
Required Volume Size
func (QingStorageClass) GetStepSizeByte ¶
func (sc QingStorageClass) GetStepSizeByte() int64
func (QingStorageClass) GetTags ¶
func (sc QingStorageClass) GetTags() []string
type Topology ¶
type Topology struct {
// contains filtered or unexported fields
}
func NewTopology ¶
func NewTopology(zone string, instanceType InstanceType) *Topology
func (*Topology) GetInstanceType ¶
func (t *Topology) GetInstanceType() InstanceType
func (*Topology) SetInstanceType ¶
func (t *Topology) SetInstanceType(instanceType InstanceType)
type VolumeType ¶
type VolumeType int
const ( HighPerformanceVolumeType VolumeType = 0 HighCapacityVolumeType VolumeType = 2 SuperHighPerformanceVolumeType VolumeType = 3 NeonSANVolumeType VolumeType = 5 NeonSANHDDVolumeType VolumeType = 6 NeonSANRDMAVolumeType VolumeType = 7 ThirdPartyStorageType VolumeType = 20 StandardVolumeType VolumeType = 100 SSDEnterpriseVolumeType VolumeType = 200 DefaultVolumeType = StandardVolumeType )
func (VolumeType) Int ¶
func (v VolumeType) Int() int
func (VolumeType) IsValid ¶
func (v VolumeType) IsValid() bool
func (VolumeType) String ¶
func (v VolumeType) String() string
func (VolumeType) ValidateAttachedOn ¶
func (v VolumeType) ValidateAttachedOn(i InstanceType) bool