Documentation ¶
Overview ¶
Package backend get is related with storage backend get operation
Index ¶
- Constants
- Variables
- func BuildBackend(ctx context.Context, content v1.StorageBackendContent) (*model.Backend, error)
- func ConvertConfigmapToMap(ctx context.Context, configmap *coreV1.ConfigMap) (map[string]interface{}, error)
- func FilterByCapability(ctx context.Context, parameters map[string]interface{}, ...) ([]*model.StoragePool, error)
- func FilterByCapacity(requestSize int64, allocType string, candidatePools []*model.StoragePool) []*model.StoragePool
- func FilterByTopology(parameters map[string]interface{}, candidatePools []*model.StoragePool) ([]*model.StoragePool, error)
- func FilterStoragePool(ctx context.Context, requestSize int64, parameters map[string]interface{}, ...) ([]*model.StoragePool, error)
- func GetAccountName(backendName string) string
- func GetBackendConfigmap(ctx context.Context, configmapMeta string) (*coreV1.ConfigMap, error)
- func GetBackendConfigmapMap(ctx context.Context, configmapMeta string) (map[string]interface{}, error)
- func GetMetroDomain(backendName string) string
- func GetMetrovStorePairID(backendName string) string
- func GetStorageBackendInfo(ctx context.Context, backendID, configmapMeta, secretMeta, certSecret string, ...) (map[string]interface{}, error)
- func NewBackend(backendName string, config map[string]interface{}) (*model.Backend, error)
- func RemoveOneBackend(ctx context.Context, storageBackendId string)
- func SelectRemotePool(ctx context.Context, requestSize int64, parameters map[string]interface{}, ...) (*model.StoragePool, error)
- func WeightPools(ctx context.Context, requestSize int64, parameters map[string]interface{}, ...) (*model.StoragePool, *model.StoragePool, error)
- func WeightSinglePools(ctx context.Context, requestSize int64, parameters map[string]interface{}, ...) (*model.StoragePool, error)
- type AccessibleTopology
- type CSIConfig
Constants ¶
const ( // Topology constant for topology filter function Topology = "topology" // NoAvailablePool message of no available poll error NoAvailablePool = "no storage pool meets the requirements" )
Variables ¶
var ( // ValidateFilterFuncs validate filters' function map ValidateFilterFuncs = [][]interface{}{ {"backend", validateBackendName}, {"volumeType", validateVolumeType}, } // PrimaryFilterFuncs primary filters' function map PrimaryFilterFuncs = [][]interface{}{ {"backend", filterByBackendName}, {"pool", filterByStoragePool}, {"volumeType", filterByVolumeType}, {"allocType", filterByAllocType}, {"qos", filterByQos}, {"hyperMetro", filterByMetro}, {"replication", filterByReplication}, {"applicationType", filterByApplicationType}, {"storageQuota", filterByStorageQuota}, {"sourceVolumeName", filterBySupportClone}, {"sourceSnapshotName", filterBySupportClone}, {"nfsProtocol", filterByNFSProtocol}, } // SecondaryFilterFuncs secondary filters' function map SecondaryFilterFuncs = [][]interface{}{ {"volumeType", filterByVolumeType}, {"allocType", filterByAllocType}, {"qos", filterByQos}, {"replication", filterByReplication}, {"applicationType", filterByApplicationType}, } )
var ValidateBackend = func(ctx context.Context, selectBackend *model.Backend, parameters map[string]interface{}) error { for _, i := range ValidateFilterFuncs { key, validator := i[0].(string), i[1].(func(context.Context, string, *model.Backend) error) value, _ := parameters[key].(string) if err := validator(ctx, value, selectBackend); err != nil { return fmt.Errorf("validate backend %s error for manage Volume. "+ "the final validator field: %s, validator function: %s, parameters %v. Reason: %v", selectBackend.Name, key, runtime.FuncForPC(reflect.ValueOf(validator).Pointer()).Name(), parameters, err) } } return nil }
ValidateBackend valid the backend basic info, such as: volumeType(authClient if nfs)
Functions ¶
func BuildBackend ¶
BuildBackend build a valid backend
func ConvertConfigmapToMap ¶
func ConvertConfigmapToMap(ctx context.Context, configmap *coreV1.ConfigMap) (map[string]interface{}, error)
ConvertConfigmapToMap converts a configmap to a map object
func FilterByCapability ¶
func FilterByCapability(ctx context.Context, parameters map[string]interface{}, candidatePools []*model.StoragePool, filterFuncs [][]interface{}) ([]*model.StoragePool, error)
FilterByCapability filter backend by capability
func FilterByCapacity ¶
func FilterByCapacity(requestSize int64, allocType string, candidatePools []*model.StoragePool) []*model.StoragePool
FilterByCapacity filter backend by capacity
func FilterByTopology ¶
func FilterByTopology(parameters map[string]interface{}, candidatePools []*model.StoragePool) ([]*model.StoragePool, error)
FilterByTopology returns a subset of the provided pools that can support any of the topology requirement.
func FilterStoragePool ¶
func FilterStoragePool(ctx context.Context, requestSize int64, parameters map[string]interface{}, candidatePools []*model.StoragePool, filterFuncs [][]interface{}) ([]*model.StoragePool, error)
FilterStoragePool filter storage pool by capability, topology and capacity.
func GetAccountName ¶
GetAccountName get account name of backend
func GetBackendConfigmap ¶
GetBackendConfigmap used to get Configmap
func GetBackendConfigmapMap ¶
func GetBackendConfigmapMap(ctx context.Context, configmapMeta string) (map[string]interface{}, error)
GetBackendConfigmapMap used to get backend info by configmapMeta
func GetMetroDomain ¶
GetMetroDomain get metro domain of backend
func GetMetrovStorePairID ¶
GetMetrovStorePairID get MetrovStorePairID of backend
func GetStorageBackendInfo ¶
func GetStorageBackendInfo(ctx context.Context, backendID, configmapMeta, secretMeta, certSecret string, useCert bool) (map[string]interface{}, error)
GetStorageBackendInfo used to get storage config info
func NewBackend ¶
NewBackend constructs an object of Kubernetes backend resource
func RemoveOneBackend ¶
RemoveOneBackend remove a storage backend from plugin
func SelectRemotePool ¶
func SelectRemotePool(ctx context.Context, requestSize int64, parameters map[string]interface{}, localBackendName string) (*model.StoragePool, error)
SelectRemotePool select the optimal remote storage pool based on the free capacity.
func WeightPools ¶
func WeightPools(ctx context.Context, requestSize int64, parameters map[string]interface{}, localPools []*model.StoragePool, poolPairs []model.SelectPoolPair) (*model.StoragePool, *model.StoragePool, error)
WeightPools select the optimal local and remote storage pool based on the free capacity.
func WeightSinglePools ¶
func WeightSinglePools( ctx context.Context, requestSize int64, parameters map[string]interface{}, filterPools []*model.StoragePool) (*model.StoragePool, error)
WeightSinglePools select the optimal storage pool based on the free capacity.
Types ¶
Directories ¶
Path | Synopsis |
---|---|
Package cache for backend cache
|
Package cache for backend cache |
Package handler contains all helper functions with backend process
|
Package handler contains all helper functions with backend process |
Package job contains all scheduled task
|
Package job contains all scheduled task |
Package model package for backend model
|
Package model package for backend model |
Package plugin provide storage function
|
Package plugin provide storage function |