driver

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageClassTypeName        = "type"
	StorageClassMaxSizeName     = "maxSize"
	StorageClassMinSizeName     = "minSize"
	StorageClassStepSizeName    = "stepSize"
	StorageClassFsTypeName      = "fsType"
	StorageClassReplicaName     = "replica"
	StorageClassTagsName        = "tags"
	StorageClassContainerConfID = "containerConfID"
	StorageClassRG              = "rg"
	StorageClassPlaceGroupID    = "placeGroupID"
)
View Source
const (
	DiskSingleReplicaType  int = 1
	DiskMultiReplicaType   int = 2
	DiskThreeReplicaType   int = 3
	DefaultDiskReplicaType int = DiskMultiReplicaType
)
View Source
const (
	DefaultInstanceIdFilePath = "/etc/qingcloud/instance-id"
)
View Source
const (
	SnapshotClassTagsName = "tags"
)

Variables

View Source
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",
}
View Source
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,
}
View Source
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,
	},
}
View Source
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

Functions

func GetInstanceIdFromFile

func GetInstanceIdFromFile(filepath string) (instanceId string, err error)

GetInstanceIdFromFile gets instance id from specific file path. In QingCloud Linux instance, it stores instance id in /etc/qingcloud/instance-id.

func IsValidFileSystemType

func IsValidFileSystemType(fs string) bool

Check file system type Support: ext3, ext4 and xfs

func IsValidReplica

func IsValidReplica(replica int) bool

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 GetDiskDriver

func GetDiskDriver() *DiskDriver

GetDiskDriver Create disk driver

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) GetZone

func (t *Topology) GetZone() string

func (*Topology) SetInstanceType

func (t *Topology) SetInstanceType(instanceType InstanceType)

func (*Topology) SetZone

func (t *Topology) SetZone(zone string)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL