common

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Overview

Package common provides common constants, variables and function used in both controller and node services.

Index

Constants

View Source
const (
	// KeyAllowRoot key value to check if driver should enable root squashing for nfs volumes
	KeyAllowRoot = "allowRoot"
	// KeyNfsExportPath key value to pass in publish context
	KeyNfsExportPath = "NfsExportPath"
	// KeyHostIP key value to pass in publish context
	KeyHostIP = "HostIP"
	// KeyExportID key value to pass in publish context
	KeyExportID = "ExportID"
	// KeyNatIP key value to pass in publish context
	KeyNatIP = "NatIP"
	// KeyArrayID key value to check in request parameters for array ip
	KeyArrayID = "arrayID"
	// KeyArrayVolumeName key value to check in request parameters for volume name
	KeyArrayVolumeName = "Name"
	// KeyProtocol key value to check in request parameters for volume name
	KeyProtocol = "Protocol"
	// VerboseName longer description of the driver
	VerboseName = "CSI Driver for Dell EMC PowerStore"
	// FcTransport indicates that FC is chosen as a SCSI transport protocol
	FcTransport TransportType = "FC"
	// ISCSITransport indicates that ISCSI is chosen as a SCSI transport protocol
	ISCSITransport TransportType = "ISCSI"
	// AutoDetectTransport indicates that SCSI transport protocol would be detected automatically
	AutoDetectTransport TransportType = "AUTO"
	// NoneTransport indicates that no SCSI transport protocol needed
	NoneTransport TransportType = "NONE"

	PublishContextDeviceWWN          = "DEVICE_WWN"
	PublishContextLUNAddress         = "LUN_ADDRESS"
	PublishContextISCSIPortalsPrefix = "PORTAL"
	PublishContextISCSITargetsPrefix = "TARGET"
	PublishContextFCWWPNPrefix       = "FCWWPN"
	WWNPrefix                        = "naa."
)
View Source
const (
	// EnvDriverName is the name of the csi driver (provisioner)
	EnvDriverName = "X_CSI_DRIVER_NAME"

	// EnvNodeIDFilePath is the name of the environment variable used to
	// specify the file with the node ID
	EnvNodeIDFilePath = "X_CSI_POWERSTORE_NODE_ID_PATH"

	// EnvKubeNodeName is the name of the environment variable which stores current kubernetes
	// node name
	EnvKubeNodeName = "X_CSI_POWERSTORE_KUBE_NODE_NAME"

	// EnvNodeNamePrefix is the name of the environment variable which stores prefix which will be
	// used when registering node on PowerStore array
	EnvNodeNamePrefix = "X_CSI_POWERSTORE_NODE_NAME_PREFIX"

	// EnvNodeChrootPath is the name of the environment variable which store path to chroot where
	// to execute iSCSI commands
	EnvNodeChrootPath = "X_CSI_POWERSTORE_NODE_CHROOT_PATH"

	// EnvTmpDir is the name of the environment variable which store path to the folder which will be used
	// for csi-powerstore temporary files
	EnvTmpDir = "X_CSI_POWERSTORE_TMP_DIR"

	// EnvFCPortsFilterFilePath is the name of the environment variable which store path to the file which
	// provide list of WWPN which should be used by the driver for FC connection on this node
	// example:
	// content of the file:
	//   21:00:00:29:ff:48:9f:6e,21:00:00:29:ff:48:9f:6e
	// If file not exist or empty or in invalid format, then the driver will use all available FC ports
	EnvFCPortsFilterFilePath = "X_CSI_FC_PORTS_FILTER_FILE_PATH"

	// EnvThrottlingRateLimit sets a number of concurrent requests to APi
	EnvThrottlingRateLimit = "X_CSI_POWERSTORE_THROTTLING_RATE_LIMIT"

	// EnvEnableCHAP is the flag which determines if the driver is going
	// to set the CHAP credentials in the ISCSI node database at the time
	// of node plugin boot
	EnvEnableCHAP = "X_CSI_POWERSTORE_ENABLE_CHAP"

	// EnvExternalAccess is the IP of an additional router you wish to add for nfs export
	// Used to provide NFS volumes behind NAT
	EnvExternalAccess = "X_CSI_POWERSTORE_EXTERNAL_ACCESS" // #nosec G101

	// EnvArrayConfigFilePath is filepath to powerstore arrays config file
	EnvArrayConfigFilePath = "X_CSI_POWERSTORE_CONFIG_PATH"

	// EnvArrayConfigFilePath is filepath to powerstore arrays config file
	EnvDebugEnableTracing = "ENABLE_TRACING"

	// EnvReplicationContextPrefix enables sidecars to read required information from volume context
	EnvReplicationContextPrefix = "X_CSI_REPLICATION_CONTEXT_PREFIX"

	// EnvReplicationPrefix is used as a prefix to find out if replication is enabled
	EnvReplicationPrefix = "X_CSI_REPLICATION_PREFIX"
)

Variables

View Source
var Manifest = map[string]string{
	"url":    "https://github.com/dell/csi-powerstore",
	"semver": core.SemVer,
	"commit": core.CommitSha32,
	"formed": core.CommitTime.Format(time.RFC1123),
}

Manifest contains additional information about the driver

View Source
var Name = "csi-powerstore.dellemc.com"

Name contains default name of the driver, can be overridden

Functions

func GetFCTargetsInfoFromStorage

func GetFCTargetsInfoFromStorage(client gopowerstore.Client) ([]gobrick.FCTargetInfo, error)

GetFCTargetsInfoFromStorage returns list of gobrick compatible FC tragets by querying PowerStore array

func GetIPListFromString

func GetIPListFromString(input string) []string

GetIPListFromString returns list of ips in string form found in input string A return value of nil indicates no match

func GetIPListWithMaskFromString

func GetIPListWithMaskFromString(input string) (string, error)

GetIPListFromString returns ip and mask in string form found in input string A return value of nil indicates no match

func GetISCSITargetsInfoFromStorage

func GetISCSITargetsInfoFromStorage(client gopowerstore.Client) ([]gobrick.ISCSITargetInfo, error)

GetISCSITargetsInfoFromStorage returns list of gobrick compatible iscsi tragets by querying PowerStore array

func GetLogFields

func GetLogFields(ctx context.Context) log.Fields

GetLogFields extracts log fields from context by using contextLogFieldsKey key

func RandomString

func RandomString(len int) string

RandomString returns a random string of specified length. String is generated by using crypto/rand.

func RmSockFile

func RmSockFile(f fs.FsInterface)

RmSockFile removes socket files that left after previous installation

func SetLogFields

func SetLogFields(ctx context.Context, fields log.Fields) context.Context

SetLogFields returns modified context with fields inserted as values by using contextLogFieldsKey key

Types

type CustomLogger

type CustomLogger struct{}

CustomLogger is logger wrapper that can be passed to gopowerstore, gobrick allowing to logging context fields with each call

func (*CustomLogger) Debug

func (lg *CustomLogger) Debug(ctx context.Context, format string, args ...interface{})

Debug is a wrapper of logrus Debug method

func (*CustomLogger) Error

func (lg *CustomLogger) Error(ctx context.Context, format string, args ...interface{})

Error is a wrapper of logrus Error method

func (*CustomLogger) Info

func (lg *CustomLogger) Info(ctx context.Context, format string, args ...interface{})

Info is a wrapper of logrus Info method

type TransportType

type TransportType string

TransportType differentiates different SCSI transport protocols (FC, iSCSI, Auto, None)

Directories

Path Synopsis
Package fs provides wrappers for os/fs dependent operations.
Package fs provides wrappers for os/fs dependent operations.

Jump to

Keyboard shortcuts

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