driver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

*

  • Copyright 2019 IBM Corp. *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Index

Constants

View Source
const (
	DefualtConfigFile     string = "config.yaml"
	EnvNameDriverConfFile string = "DRIVER_CONFIG_YML"
)
View Source
const (
	// In the Dockerfile of the node, specific commands (e.g: multipath, mount...) from the host mounted inside the container in /host directory.
	// Command lines inside the container will show /host prefix.
	PrefixChrootOfHostRoot = "/host"
	FCPath                 = "/sys/class/fc_host"
	FCPortPath             = "/sys/class/fc_host/host*/port_name"
)

Variables

View Source
var ErrorUnsupportedConnectivityType = "Unsupported connectivity type : {%v}"
View Source
var ErrorWhileTryingToReadFC = "Error while tring to get FC port from string: %v."
View Source
var ErrorWhileTryingToReadIQN = "Error while trying to get iqn  from string: %v."
View Source
var (
	IscsiFullPath = "/host/etc/iscsi/initiatorname.iscsi"
)

Functions

func GetVersionJSON

func GetVersionJSON(configFilePath string) (string, error)

Types

type ConfigFile

type ConfigFile struct {
	Identity struct {
		Name    string
		Version string
	}
	Controller struct {
		Publish_context_lun_parameter          string
		Publish_context_connectivity_parameter string
		Publish_context_array_iqn              string
		Publish_context_fc_initiators          string
	}
}

func ReadConfigFile

func ReadConfigFile(configFilePath string) (ConfigFile, error)

type ConfigYmlEmptyAttribute

type ConfigYmlEmptyAttribute struct {
	Attr string
}

func (*ConfigYmlEmptyAttribute) Error

func (e *ConfigYmlEmptyAttribute) Error() string

type Driver

type Driver struct {
	NodeService
	// contains filtered or unexported fields
}

func NewDriver

func NewDriver(endpoint string, configFilePath string, hostname string) (*Driver, error)

func (*Driver) GetPluginInfo

func (d *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

func (*Driver) Probe

func (d *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

func (*Driver) Run

func (d *Driver) Run() error

func (*Driver) Stop

func (d *Driver) Stop()

type NodeService

type NodeService struct {
	ConfigYaml ConfigFile
	Hostname   string
	NodeUtils  NodeUtilsInterface

	VolumeIdLocksMap            SyncLockInterface
	OsDeviceConnectivityMapping map[string]device_connectivity.OsDeviceConnectivityInterface
	// contains filtered or unexported fields
}

nodeService represents the node service of CSI driver

func NewNodeService

func NewNodeService(configYaml ConfigFile, hostname string, nodeUtils NodeUtilsInterface, OsDeviceConnectivityMapping map[string]device_connectivity.OsDeviceConnectivityInterface, executer executer.ExecuterInterface, mounter *mount.SafeFormatAndMount, syncLock SyncLockInterface) NodeService

newNodeService creates a new node service it panics if failed to create the service

func (*NodeService) NodeExpandVolume

func (*NodeService) NodeGetCapabilities

func (*NodeService) NodeGetInfo

func (*NodeService) NodeGetVolumeStats

func (*NodeService) NodePublishVolume

func (*NodeService) NodeStageVolume

func (*NodeService) NodeUnpublishVolume

func (*NodeService) NodeUnstageVolume

type NodeUtils

type NodeUtils struct {
	Executer executer.ExecuterInterface
}

func NewNodeUtils

func NewNodeUtils(executer executer.ExecuterInterface) *NodeUtils

func (NodeUtils) ClearStageInfoFile

func (n NodeUtils) ClearStageInfoFile(filePath string) error

func (NodeUtils) Exists added in v0.9.0

func (n NodeUtils) Exists(path string) bool

func (NodeUtils) GetInfoFromPublishContext

func (n NodeUtils) GetInfoFromPublishContext(publishContext map[string]string, configYaml ConfigFile) (string, int, []string, error)

func (NodeUtils) GetSysDevicesFromMpath

func (n NodeUtils) GetSysDevicesFromMpath(device string) (string, error)

func (NodeUtils) ParseFCPorts added in v0.9.0

func (n NodeUtils) ParseFCPorts() ([]string, error)

func (NodeUtils) ParseIscsiInitiators

func (n NodeUtils) ParseIscsiInitiators() (string, error)

func (NodeUtils) ReadFromStagingInfoFile

func (n NodeUtils) ReadFromStagingInfoFile(filePath string) (map[string]string, error)

func (NodeUtils) StageInfoFileIsExist

func (n NodeUtils) StageInfoFileIsExist(filePath string) bool

func (NodeUtils) WriteStageInfoToFile

func (n NodeUtils) WriteStageInfoToFile(fPath string, info map[string]string) error

type NodeUtilsInterface

type NodeUtilsInterface interface {
	ParseIscsiInitiators() (string, error)
	ParseFCPorts() ([]string, error)
	GetInfoFromPublishContext(publishContext map[string]string, configYaml ConfigFile) (string, int, []string, error)
	GetSysDevicesFromMpath(baseDevice string) (string, error)

	// TODO refactor and move all staging methods to dedicate interface.
	WriteStageInfoToFile(path string, info map[string]string) error
	ReadFromStagingInfoFile(filePath string) (map[string]string, error)
	ClearStageInfoFile(filePath string) error
	StageInfoFileIsExist(filePath string) bool
	Exists(filePath string) bool
}

type RequestValidationError

type RequestValidationError struct {
	Msg string
}

func (*RequestValidationError) Error

func (e *RequestValidationError) Error() string

type SyncLock

type SyncLock struct {
	SyncMap *sync.Map
}

func (SyncLock) AddVolumeLock

func (s SyncLock) AddVolumeLock(id string, msg string) error

func (SyncLock) GetSyncMap

func (s SyncLock) GetSyncMap() *sync.Map

func (SyncLock) RemoveVolumeLock

func (s SyncLock) RemoveVolumeLock(id string, msg string)

type SyncLockInterface

type SyncLockInterface interface {
	AddVolumeLock(id string, msg string) error
	RemoveVolumeLock(id string, msg string)
	GetSyncMap() *sync.Map
}

func NewSyncLock

func NewSyncLock() SyncLockInterface

type VersionInfo

type VersionInfo struct {
	DriverVersion string `json:"driverVersion"`
	GitCommit     string `json:"gitCommit"`
	BuildDate     string `json:"buildDate"`
	GoVersion     string `json:"goVersion"`
	Compiler      string `json:"compiler"`
	Platform      string `json:"platform"`
}

func GetVersion

func GetVersion(configFilePath string) (VersionInfo, error)

type VolumeAlreadyProcessingError

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

func (*VolumeAlreadyProcessingError) Error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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