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) GetDiskType() VolumeType
- func (sc QingStorageClass) GetFsType() string
- func (sc QingStorageClass) GetMaxSizeByte() int64
- func (sc QingStorageClass) GetMinSizeByte() int64
- 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" )
const ( DiskSingleReplicaType int = 1 DiskMultiReplicaType int = 2 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 InstanceTypeName = map[InstanceType]string{
0: "HighPerformance",
1: "SuperHighPerformance",
6: "SuperHighPerformanceSAN",
7: "HighPerformanceSAN",
101: "Standard",
201: "Enterprise1",
202: "Enterprise2",
301: "Premium",
}
var InstanceTypeValue = map[string]InstanceType{
"HighPerformance": 0,
"SuperHighPerformance": 1,
"SuperHighPerformanceSAN": 6,
"HighPerformanceSAN": 7,
"Standard": 101,
"Enterprise1": 201,
"Enterprise2": 202,
"Premium": 301,
}
var VolumeTypeAttachConstraint = map[VolumeType][]InstanceType{ HighPerformanceVolumeType: { HighPerformanceInstanceType, StandardInstanceType, }, HighCapacityVolumeType: { HighPerformanceInstanceType, SuperHighPerformanceInstanceType, StandardInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, PremiumInstanceType, }, SuperHighPerformanceVolumeType: { SuperHighPerformanceInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, PremiumInstanceType, }, NeonSANVolumeType: { HighPerformanceInstanceType, SuperHighPerformanceInstanceType, SuperHighPreformanceSANInstanceType, StandardInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, PremiumInstanceType, }, NeonSANHDDVolumeType: { HighPerformanceInstanceType, SuperHighPerformanceInstanceType, HighPerformanceSANInstanceType, StandardInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, PremiumInstanceType, }, StandardVolumeType: { HighPerformanceInstanceType, StandardInstanceType, }, SSDEnterpriseVolumeType: { SuperHighPerformanceInstanceType, Enterprise1InstanceType, Enterprise2InstanceType, PremiumInstanceType, }, }
var VolumeTypeName = map[VolumeType]string{
0: "HighPerformance",
2: "HighCapacity",
3: "SuperHighPerformance",
5: "NeonSAN",
6: "NeonSANHDD",
100: "Standard",
200: "SSDEnterprise",
}
convert volume type to string https://docs.qingcloud.com/product/api/action/volume/create_volumes.html
var VolumeTypeToMaxSize = map[VolumeType]int{
0: 2000,
2: 5000,
3: 2000,
5: 50000,
6: 50000,
100: 2000,
200: 2000,
}
var VolumeTypeToMinSize = map[VolumeType]int{
0: 10,
2: 100,
3: 10,
5: 100,
6: 100,
100: 10,
200: 10,
}
var VolumeTypeToStepSize = map[VolumeType]int{
0: 10,
2: 50,
3: 10,
5: 100,
6: 100,
100: 10,
200: 10,
}
var VolumeTypeValue = map[string]VolumeType{
"HighPerformance": 0,
"HighCapacity": 2,
"SuperHighPerformance": 3,
"NeonSAN": 5,
"NeonSANHDD": 6,
"Standard": 100,
"SSDEnterprise": 200,
}
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 SuperHighPreformanceSANInstanceType InstanceType = 6 HighPerformanceSANInstanceType InstanceType = 7 StandardInstanceType InstanceType = 101 Enterprise1InstanceType InstanceType = 201 Enterprise2InstanceType InstanceType = 202 PremiumInstanceType InstanceType = 301 )
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) (*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) 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) 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 ( DefaultVolumeType VolumeType = StandardVolumeType HighPerformanceVolumeType VolumeType = 0 HighCapacityVolumeType VolumeType = 2 SuperHighPerformanceVolumeType VolumeType = 3 NeonSANVolumeType VolumeType = 5 NeonSANHDDVolumeType VolumeType = 6 StandardVolumeType VolumeType = 100 SSDEnterpriseVolumeType VolumeType = 200 )
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