service

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 38 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 (
	// KeyStoragePool is the key used to get the storagepool name from the
	// volume create parameters map
	KeyStoragePool = "storagepool"

	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
	// GiB is 1 Gibibyte in bytes
	GiB = 1073741824

	TRUE                         = "TRUE"
	FALSE                        = "FALSE"
	StoragePoolCacheDuration     = 4 * time.Hour
	MaxVolIdentifierLength       = 64
	MaxPortGroupIdentifierLength = 64
	MaxClusterPrefixLength       = 3
	NumOfVolIDAttributes         = 4
	CSIPrefix                    = "csi"
	DeletionPrefix               = "_DEL"
	SymmetricIDLength            = 12
	DeviceIDLength               = 5
	CsiHostPrefix                = "csi-node-"
	CsiMVPrefix                  = "csi-mv-"
	CsiNoSrpSGPrefix             = "csi-no-srp-sg-"
	CsiVolumePrefix              = "csi-"
	PublishContextDeviceWWN      = "DEVICE_WWN"
	PublishContextLUNAddress     = "LUN_ADDRESS"
	PortIdentifiers              = "PORT_IDENTIFIERS"
	PortIdentifierKeyCount       = "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"
)

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

Keys for parameters to CreateVolume

View Source
const (
	DeletionQueueLength = 10000
	MaxRequestsPerStep  = 1000
	MaxErrorsStored     = 5
	MaxErrorCount       = 100
	CacheValidTime      = 30 * time.Minute
	MinPollingInterval  = 3 * 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"

	// EnvVersion is the name of the enviroment variable used to set the
	// U4P version when authenticating to Unisphere
	EnvVersion = "X_CSI_POWERMAX_VERSION"

	// EnvInsecure is the name of the enviroment variable used to specify
	// that Unisphere's certificate chain and host name should not
	// be validated.
	// This is deprecated- use X_CSI_POWERMAX_SKIP_CERTIFICATE_VALIDATION instead.
	EnvInsecure = "X_CSI_POWERMAX_INSECURE"

	// 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"
	// EnvArrayWhitelist is the name of the environment variable that is used
	// to specifiy a list of Arrays the the driver can choose from.
	// An empty list will allow all arrays known to Unisphere to be used.
	EnvArrayWhitelist = "X_CSI_POWERMAX_ARRAYS"

	// 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"
)
View Source
const (
	// Name is the name of the CSI plug-in.
	Name = "csi-powermax.dellemc.com"
	// ApplicationName is the name used to register with Powermax REST APIs
	ApplicationName = "CSI Driver for Dell EMC PowerMax"
	// KeyThickProvisioning is the key used to get a flag indicating that
	// a volume should be thick provisioned from the volume create params
	KeyThickProvisioning = "thickprovisioning"
)
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 added in v1.2.0

func CleanupMapEntries(duration time.Duration)

CleanupMapEntries - clean up stale entries from the map

func GetRDFInfoFromSGID added in v1.6.0

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

GetRDFInfoFromSGID returns namespace , RDFG number and replication mode

func LockRequestHandler added in v1.2.0

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 added in v1.2.0

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 added in v1.2.0

type FCTargetInfo struct {
	WWPN string
}

FCTargetInfo represents basic information about FC target

type ISCSITargetInfo added in v1.2.0

type ISCSITargetInfo struct {
	Portal string
	Target string
}

ISCSITargetInfo represents basic information about iSCSI target

type LockInfo added in v1.2.0

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 added in v1.2.0

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 added in v1.2.0

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
	Version                    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
	AllowedArrays              []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 added in v1.1.0

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 added in v1.2.0

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