manage

package
v4.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package manage provides manage operations for storage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildParameters

func BuildParameters(opts ...BuildParameterOption) (map[string]interface{}, error)

BuildParameters build request parameters based on the incoming build function

func CheckParam

func CheckParam(ctx context.Context, req *csi.NodeStageVolumeRequest) error

CheckParam check node stage volume request parameters

func ExtractWwn

func ExtractWwn(parameters map[string]interface{}) (string, error)

ExtractWwn extract wwn from the request parameters

func Mount

func Mount(ctx context.Context, parameters map[string]interface{}) error

Mount use nfs protocol to mount

func PublishBlock

func PublishBlock(ctx context.Context, req *csi.NodePublishVolumeRequest) error

PublishBlock publish block device

func PublishFilesystem

func PublishFilesystem(ctx context.Context, req *csi.NodePublishVolumeRequest) error

PublishFilesystem publish filesystem

func Unmount

func Unmount(ctx context.Context, targetPath string) error

Unmount use nfs protocol to unmount

Types

type BackendConfig

type BackendConfig struct {
	// contains filtered or unexported fields
}

BackendConfig backend configuration

func GetBackendConfig

func GetBackendConfig(ctx context.Context, backendName string) (*BackendConfig, error)

GetBackendConfig returns a BackendConfig if specified backendName exists in configmap. If backend doesn't exist in configmap, returns an error from call backend.GetBackendConfigmapByClaimName(). If parameters and protocol doesn't exist, a custom error will be returned. If protocol exist and equal to nfs or nfs+, portals in parameters must exist, otherwise an error will be returned.

type BuildParameterOption

type BuildParameterOption func(map[string]interface{}) error

BuildParameterOption define build function

func WithConnector

func WithConnector(conn connector.Connector) BuildParameterOption

WithConnector build connector for the request parameters

func WithControllerPublishInfo

func WithControllerPublishInfo(ctx context.Context, req *csi.NodeStageVolumeRequest) BuildParameterOption

WithControllerPublishInfo build publishInfo for the request parameters

func WithMultiPathType

func WithMultiPathType(protocol string) BuildParameterOption

WithMultiPathType build multiPathType for the request parameters

func WithPortals

func WithPortals(publishContext map[string]string, protocol string, portals, metroPortals []string,
) BuildParameterOption

WithPortals build portals for the request parameters

func WithProtocol

func WithProtocol(protocol string) BuildParameterOption

WithProtocol build protocol for the request parameters

func WithVolumeCapability

func WithVolumeCapability(ctx context.Context, req *csi.NodeStageVolumeRequest) BuildParameterOption

WithVolumeCapability build volume capability for the request parameters

type ControllerPublishInfo

type ControllerPublishInfo struct {
	TgtLunWWN          string             `json:"tgtLunWWN"`
	TgtPortals         []string           `json:"tgtPortals"`
	TgtIQNs            []string           `json:"tgtIQNs"`
	TgtHostLUNs        []string           `json:"tgtHostLUNs"`
	TgtLunGuid         string             `json:"tgtLunGuid"`
	TgtWWNs            []string           `json:"tgtWWNs"`
	PortWWNList        []nvme.PortWWNPair `json:"portWWNList"`
	VolumeUseMultiPath bool               `json:"volumeUseMultiPath"`
	MultiPathType      string             `json:"multiPathType"`
}

ControllerPublishInfo context passed by ControllerPublishVolume VolumeUseMultiPath is required, and if it is equal true, then MultiPathType is required iscsi protocol: TgtPortals, TgtIQNs, TgtHostLUNs, TgtLunWWN is required fc protocol: TgtLunWWN, TgtWWNs, TgtHostLUNs is required fc-nvme protocol: PortWWNList, TgtLunGuid is required roce protocol: TgtPortals, TgtLunGuid is required scsi protocol: TgtLunWWN is required

func (*ControllerPublishInfo) ReflectToMap

func (c *ControllerPublishInfo) ReflectToMap() map[string]interface{}

ReflectToMap use reflection to convert ControllerPublishInfo to map, where key of map is json tag and value of map is field value

type Manager

type Manager interface {
	StageVolume(context.Context, *csi.NodeStageVolumeRequest) error
	UnStageVolume(context.Context, *csi.NodeUnstageVolumeRequest) error
	ExpandVolume(context.Context, *csi.NodeExpandVolumeRequest) error
	UnStageWithWwn(ctx context.Context, wwn, volumeId string) error
}

Manager defines the operations which storage manager should implement

func NewManager

func NewManager(ctx context.Context, backendName string) (Manager, error)

NewManager build a manager instance, such as NasManager, SanManager

func NewNasManager

func NewNasManager(ctx context.Context, protocol, dTreeParentName string, portals, metroPortals []string) (Manager,
	error)

NewNasManager build a nas manager instance according to the protocol

func NewSanManager

func NewSanManager(ctx context.Context, protocol string) (Manager, error)

NewSanManager build a san manager instance according to the protocol

type NasManager

type NasManager struct {
	Conn connector.Connector
	// contains filtered or unexported fields
}

NasManager implements Manager interface

func (*NasManager) ExpandVolume

func (m *NasManager) ExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) error

ExpandVolume for nas volumes, nodeExpandVolume is not required, because the NodeExpandionRequired field returned by ControllerExpandVolume is equal to false

func (*NasManager) StageVolume

func (m *NasManager) StageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) error

StageVolume stage volume

func (*NasManager) UnStageVolume

func (m *NasManager) UnStageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) error

UnStageVolume for nas volumes, unstage is only umount the staging target path

func (*NasManager) UnStageWithWwn

func (m *NasManager) UnStageWithWwn(ctx context.Context, wwn, volumeId string) error

UnStageWithWwn for nas volumes, unstage is only umount the staging target path

type SanManager

type SanManager struct {
	Conn connector.Connector
	// contains filtered or unexported fields
}

SanManager implements Manager interface

func (*SanManager) ExpandVolume

func (m *SanManager) ExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) error

ExpandVolume return nil error if specified volume expand success If getting device wwn failed, return an error with call getDeviceWwn. If the device expand failed according to the specified wwn, return an error with call connector.ResizeBlock. If the volume capability is mount, will need to call connector.ResizeMountPath.

func (*SanManager) StageVolume

func (m *SanManager) StageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) error

StageVolume stage volume

func (*SanManager) UnStageVolume

func (m *SanManager) UnStageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) error

UnStageVolume for block volumes, unstage needs to remove from the host

func (*SanManager) UnStageWithWwn

func (m *SanManager) UnStageWithWwn(ctx context.Context, wwn, volumeId string) error

UnStageWithWwn unstage volume by wwn

Jump to

Keyboard shortcuts

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