service

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: Apache-2.0 Imports: 40 Imported by: 0

README

csi-powermax - service

This directory contains the CSI Driver source code

Unit Tests

Unit Tests exist for the CSI Driver. These tests do not modify the array or require a Kubernetes instance.

Running Unit Tests

To run these tests, from the root directory of the repository, run:

make unit-test

Integration Tests

Integration Tests exist for the CSI Driver. These tests do not require a Kubernetes instance but WILL MODIFY the array

Pre-requisites

Before running integration tests, examine the env.sh script in the root of the repository. Within that file, two variables are defined:

  • X_CSI_POWERMAX_USER
  • X_CSI_POWERMAX_PASSWORD

Either change those variables to match an existing user in Unisphere, or create a new user in Unisphere matching those credentials.

Running Integration Tests

To run these tests, from the root directory of the repository, run:

make integration-test

Documentation

Index

Constants

View Source
const (
	DefaultVolumeSizeBytes = 1073741824
	// MinVolumeSizeBytes - This is the minimum volume size in bytes. This is equal to
	// the number of bytes to create a volume which requires 1 cylinder less than
	// the number of bytes required for 50 MB
	MinVolumeSizeBytes = 51118080
	// MaxVolumeSizeBytes - This is the maximum volume size in bytes. This is equal to
	// the minimum number of bytes required to create a 1 TB volume on Powermax arrays
	MaxVolumeSizeBytes = 1099512545280

	StoragePoolCacheDuration       = 4 * time.Hour
	MaxVolIdentifierLength         = 64
	MaxPortGroupIdentifierLength   = 64
	MaxClusterPrefixLength         = 3
	CSIPrefix                      = "csi"
	DeletionPrefix                 = "_DEL"
	CsiHostPrefix                  = "csi-node-"
	CsiMVPrefix                    = "csi-mv-"
	CsiNoSrpSGPrefix               = "csi-no-srp-sg-"
	CsiVolumePrefix                = "csi-"
	CsiRepSGPrefix                 = "csi-rep-sg-"
	PublishContextDeviceWWN        = "DEVICE_WWN"
	RemotePublishContextDeviceWWN  = "REMOTE_DEVICE_WWN"
	PublishContextLUNAddress       = "LUN_ADDRESS"
	RemotePublishContextLUNAddress = "REMOTE_LUN_ADDRESS"
	PortIdentifiers                = "PORT_IDENTIFIERS"
	RemotePortIdentifiers          = "REMOTE_PORT_IDENTIFIERS"
	PortIdentifierKeyCount         = "PORT_IDENTIFIER_KEYS"
	RemotePortIdentifierKeyCount   = "REMOTE_PORT_IDENTIFIER_KEYS"
	MaxPortIdentifierLength        = 128
	FCSuffix                       = "-FC"
	PGSuffix                       = "PG"

	IscsiTransportProtocol  = "ISCSI"
	FcTransportProtocol     = "FC"
	MaxSnapIdentifierLength = 32
	SnapDelPrefix           = "DEL"

	StorageGroup   = "StorageGroup"
	Async          = "ASYNC"
	Sync           = "SYNC"
	Metro          = "METRO"
	Consistent     = "Consistent"
	Synchronized   = "Synchronized"
	FailedOver     = "Failed Over"
	Suspended      = "Suspended"
	Invalid        = "Invalid"
	Split          = "Split"
	SyncInProgress = "SyncInProg"
)

constants

View Source
const (
	SymmetrixIDParam  = "SYMID"
	ServiceLevelParam = "ServiceLevel"
	ContentSource     = "VolumeContentSource"
	StoragePoolParam  = "SRP"
	// If storage_group is set, this over-rides the generation of the Storage Group from SLO/SRP
	StorageGroupParam      = "StorageGroup"
	ThickVolumesParam      = "ThickVolumes" // "true" or "false" or "" (defaults thin)
	ApplicationPrefixParam = "ApplicationPrefix"
	CapacityGB             = "CapacityGB"

	// These params will be in replication enabled storage class
	RepEnabledParam              = "isReplicationEnabled"
	LocalRDFGroupParam           = "RdfGroup"
	RemoteRDFGroupParam          = "RemoteRDFGroup"
	RemoteSymIDParam             = "RemoteSYMID"
	RemoteVolumeIDParam          = "RemoteVolumeID"
	ReplicationModeParam         = "RdfMode"
	CSIPVCNamespace              = "csi.storage.k8s.io/pvc/namespace"
	CSIPersistentVolumeName      = "csi.storage.k8s.io/pv/name"
	CSIPersistentVolumeClaimName = "csi.storage.k8s.io/pvc/name"
	// These map to the above fields in the form of HTTP header names.
	HeaderPersistentVolumeName           = "x-csi-pv-name"
	HeaderPersistentVolumeClaimName      = "x-csi-pv-claimname"
	HeaderPersistentVolumeClaimNamespace = "x-csi-pv-namespace"
	RemoteServiceLevelParam              = "RemoteServiceLevel"
	RemoteSRPParam                       = "RemoteSRP"
	BiasParam                            = "Bias"
)

Keys for parameters to CreateVolume

View Source
const (
	DeletionQueueLength    = 10000
	MaxRequestsPerStep     = 1000
	MaxErrorsStored        = 5
	MaxErrorCount          = 100
	CacheValidTime         = 30 * time.Minute
	MinPollingInterval     = 3 * time.Second
	WaitTillSyncInProgTime = 20 * time.Second

	FinalError = "Final error: Max error count reached, device will be removed from Deletion Queue"
)

Constants used by deletion worker

View Source
const (
	// EnvDriverName is the name of the enviroment variable used to set the
	// name of the driver
	EnvDriverName = "X_CSI_POWERMAX_DRIVER_NAME"
	// EnvEndpoint is the name of the enviroment variable used to set the
	// HTTP endpoint of Unisphere
	EnvEndpoint = "X_CSI_POWERMAX_ENDPOINT"

	// EnvUser is the name of the enviroment variable used to set the
	// username when authenticating to Unisphere
	EnvUser = "X_CSI_POWERMAX_USER"

	// EnvPassword is the name of the enviroment variable used to set the
	// user's password when authenticating to Unisphere
	// #nosec G101
	EnvPassword = "X_CSI_POWERMAX_PASSWORD"

	// EnvSkipCertificateValidation is the name of the environment variable used
	// to specify Unisphere's certificate chain and host name should not
	// be validated.
	EnvSkipCertificateValidation = "X_CSI_POWERMAX_SKIP_CERTIFICATE_VALIDATION"

	// EnvNodeName is the name of the enviroment variable used to set the
	// hostname where the node service is running
	EnvNodeName = "X_CSI_POWERMAX_NODENAME"

	// EnvThick is the name of the enviroment variable used to specify
	// that thick provisioning should be used when creating volumes
	EnvThick = "X_CSI_POWERMAX_THICKPROVISIONING"

	// EnvAutoProbe is the name of the environment variable used to specify
	// that the controller service should automatically probe itself if it
	// receives incoming requests before having been probed, in direct
	// violation of the CSI spec
	EnvAutoProbe = "X_CSI_POWERMAX_AUTOPROBE"

	// EnvPortGroups is the name of the environment variable that is used
	// to specifiy a list of Port Groups that the driver can choose from
	// These Port Groups must exist and be populated
	EnvPortGroups = "X_CSI_POWERMAX_PORTGROUPS"

	// EnvClusterPrefix is the name of the environment variable that is used
	// to specifiy a a prefix to apply to objects creaated via this CSI cluster
	EnvClusterPrefix = "X_CSI_K8S_CLUSTER_PREFIX"

	// EnvISCSIChroot is the path to which the driver will chroot before
	// running any iscsi commands. This value should only be set when instructed
	// by technical support.
	EnvISCSIChroot = "X_CSI_ISCSI_CHROOT"

	// EnvGrpcMaxThreads is the configuration value of the maximum number of concurrent
	// grpc requests. This value should be an integer string.
	EnvGrpcMaxThreads = "X_CSI_GRPC_MAX_THREADS"

	// EnvEnableBlock enables block capabilities support.
	EnvEnableBlock = "X_CSI_ENABLE_BLOCK"

	// EnvPreferredTransportProtocol enables you to be able to force the transport protocol.
	// Valid values are "FC" or "ISCSI" or "". If "", will choose FC if both are available.
	// This is mainly for testing.
	EnvPreferredTransportProtocol = "X_CSI_TRANSPORT_PROTOCOL"

	// EnvUnisphereProxyServiceName is the name of the proxy service in kubernetes
	// If set, then driver will attempt to read the associated env value
	// If set to none, then the driver will connect to Unisphere
	EnvUnisphereProxyServiceName = "X_CSI_POWERMAX_PROXY_SERVICE_NAME"

	// EnvSidecarProxyPort is the port port on which the reverse proxy
	// server run, if run as a sidecar container
	EnvSidecarProxyPort = "X_CSI_POWERMAX_SIDECAR_PROXY_PORT"

	// 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_POWERMAX_ISCSI_ENABLE_CHAP"

	// EnvISCSICHAPUserName is the the username for the ISCSI CHAP
	// authentication for the host initiator(s)
	// If set to none, then the driver will use the ISCSI IQN as the username
	EnvISCSICHAPUserName = "X_CSI_POWERMAX_ISCSI_CHAP_USERNAME"

	// EnvISCSICHAPPassword is the the password for the ISCSI CHAP
	// authentication for the host initiator(s)
	// #nosec G101
	EnvISCSICHAPPassword = "X_CSI_POWERMAX_ISCSI_CHAP_PASSWORD"

	// EnvNodeNameTemplate is the templatized name to construct node names
	// by the driver based on a name format as specified by the user in this
	// variable
	EnvNodeNameTemplate = "X_CSI_IG_NODENAME_TEMPLATE"

	// EnvModifyHostName when this value is set to "true", the driver will
	// modify the existing host name to a new name as specified in the EnvNodeNameTemplate
	EnvModifyHostName = "X_CSI_IG_MODIFY_HOSTNAME"

	// EnvProxyEnabled is the flag which indicates if the REST endpoint URL
	// is pointing to the reverse proxy
	// Only used for testing
	EnvProxyEnabled = "X_CSI_REVERSE_PROXY_ENABLED"

	// 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"

	// EnvManagedArrays is an env variable with a list of space separated arrays.
	EnvManagedArrays = "X_CSI_MANAGED_ARRAYS"

	//EnvConfigFilePath is an env variable which contains the full path for the config file
	EnvConfigFilePath = "X_CSI_POWERMAX_CONFIG_PATH"
)
View Source
const (
	Establish = "Establish"
	Resume    = "Resume"
	Suspend   = "Suspend"
	FailOver  = "Failover"
	Swap      = "Swap"
	FailBack  = "Failback"
	Reprotect = "Reprotect"
)

Supported actions

View Source
const (
	Name            = "csi-powermax.dellemc.com"         // Name is the name of the CSI plug-in.
	ApplicationName = "CSI Driver for Dell EMC PowerMax" // ApplicationName is the name used to register with Powermax REST APIs

	CSILogLevelParam  = "CSI_LOG_LEVEL"
	CSILogFormatParam = "CSI_LOG_FORMAT"
)

Constants for the service

View Source
const (
	TempSnap       = "CSI_TEMP_SNAP"
	Defined        = "Defined"
	Link           = "Link"
	Unlink         = "Unlink"
	Rename         = "Rename"
	MaxUnlinkCount = 5
)

The follow constants are for internal use within the pmax library.

Variables

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

Manifest is the SP's manifest.

Functions

func CleanupMapEntries

func CleanupMapEntries(duration time.Duration)

CleanupMapEntries - clean up stale entries from the map

func GetRDFInfoFromSGID

func GetRDFInfoFromSGID(storageGroupID string) (namespace string, rDFGno string, repMode string, err error)

GetRDFInfoFromSGID returns namespace , RDFG number and replication mode

func LockRequestHandler

func LockRequestHandler()

LockRequestHandler - goroutine which listens for any lock/unlock requests

func ReleaseLock

func ReleaseLock(resourceID string, requestID string, lockNum int)

ReleaseLock - Release a held lock for resourceID Input lockNum should be the same as one returned by RequestLock

func RequestLock

func RequestLock(resourceID string, requestID string) int

RequestLock - Request for lock for a given resource ID requestID is optional returns a lock number which is used later to release the lock

Types

type Device

type Device struct {
	FullPath string
	Name     string
	RealDev  string
}

Device is a struct for holding details about a block device

func GetDevice

func GetDevice(path string) (*Device, error)

GetDevice returns a Device struct with info about the given device, or an error if it doesn't exist or is not a block device

type FCTargetInfo

type FCTargetInfo struct {
	WWPN string
}

FCTargetInfo represents basic information about FC target

type ISCSITargetInfo

type ISCSITargetInfo struct {
	Portal string
	Target string
}

ISCSITargetInfo represents basic information about iSCSI target

type LockInfo

type LockInfo struct {
	LockRequests       chan LockRequestInfo
	CurrentLockNumber  int
	CurrentWaitChannel chan int
	Count              int
}

LockInfo - Stores information about each resource id in the map

type LockRequest

type LockRequest struct {
	ResourceID  string
	LockNumber  int
	Unlock      bool
	WaitChannel chan int
}

LockRequest - Input structure to specify a request for locking a resource

type LockRequestInfo

type LockRequestInfo struct {
	LockNumber  int
	WaitChannel chan int
}

LockRequestInfo - Stores information about each lock request

type Opts

type Opts struct {
	Endpoint                   string
	UseProxy                   bool
	ProxyServiceHost           string
	ProxyServicePort           string
	User                       string
	Password                   string
	SystemName                 string
	NodeName                   string
	TransportProtocol          string
	DriverName                 string
	CHAPUserName               string
	CHAPPassword               string
	Insecure                   bool
	Thick                      bool
	AutoProbe                  bool
	EnableBlock                bool
	EnableCHAP                 bool
	PortGroups                 []string
	ClusterPrefix              string
	ManagedArrays              []string
	DisableCerts               bool   // used for unit testing only
	Lsmod                      string // used for unit testing only
	EnableSnapshotCGDelete     bool   // when snapshot deleted, enable deleting of all snaps in the CG of the snapshot
	EnableListVolumesSnapshots bool   // when listing volumes, include snapshots and volumes
	GrpcMaxThreads             int    // Maximum threads configured in grpc
	NonDefaultRetries          bool   // Indicates if non-default retry values to be used for deletion worker, only for unit testing
	NodeNameTemplate           string
	ModifyHostName             bool
	IsReverseProxyEnabled      bool
	ReplicationContextPrefix   string // Enables sidecars to read required information from volume context
	ReplicationPrefix          string // Used as a prefix to find out if replication is enabled
}

Opts defines service configuration options.

type Pair

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

Pair - structure which holds a pair

type Service

type Service interface {
	csi.ControllerServer
	csi.IdentityServer
	csi.NodeServer
	csiext.ReplicationServer
	BeforeServe(context.Context, *gocsi.StoragePlugin, net.Listener) error
	RegisterAdditionalServers(server *grpc.Server)
}

Service is the CSI Mock service provider.

func New

func New() Service

New returns a new Service.

type SnapSession

type SnapSession struct {
	Source     string
	Name       string
	Generation int64
	Expired    bool
	Target     []types.SnapTarget
}

SnapSession is an intermediate structure to share session info

Jump to

Keyboard shortcuts

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