Documentation
¶
Overview ¶
Package manage provides manage operations for storage
Index ¶
- func BuildParameters(opts ...BuildParameterOption) (map[string]interface{}, error)
- func CheckParam(ctx context.Context, req *csi.NodeStageVolumeRequest) error
- func ExtractWwn(parameters map[string]interface{}) (string, error)
- func Mount(ctx context.Context, parameters map[string]interface{}) error
- func PublishBlock(ctx context.Context, req *csi.NodePublishVolumeRequest) error
- func PublishFilesystem(ctx context.Context, req *csi.NodePublishVolumeRequest) error
- func Unmount(ctx context.Context, targetPath string) error
- type BackendConfig
- type BuildParameterOption
- func WithConnector(conn connector.Connector) BuildParameterOption
- func WithControllerPublishInfo(ctx context.Context, req *csi.NodeStageVolumeRequest) BuildParameterOption
- func WithMultiPathType(protocol string) BuildParameterOption
- func WithPortals(publishContext map[string]string, protocol string, ...) BuildParameterOption
- func WithProtocol(protocol string) BuildParameterOption
- func WithVolumeCapability(ctx context.Context, req *csi.NodeStageVolumeRequest) BuildParameterOption
- type ControllerPublishInfo
- type Manager
- type NasManager
- func (m *NasManager) ExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) error
- func (m *NasManager) StageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) error
- func (m *NasManager) UnStageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) error
- func (m *NasManager) UnStageWithWwn(ctx context.Context, wwn, volumeId string) error
- type SanManager
- func (m *SanManager) ExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) error
- func (m *SanManager) StageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) error
- func (m *SanManager) UnStageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) error
- func (m *SanManager) UnStageWithWwn(ctx context.Context, wwn, volumeId string) error
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 ¶
ExtractWwn extract wwn from the request parameters
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
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 ¶
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 ¶
NewManager build a manager instance, such as NasManager, SanManager
type NasManager ¶
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 ¶
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