Skip to content

Commit

Permalink
PowerStore CSI driver Support for the multiple interface for iSCSI di…
Browse files Browse the repository at this point in the history
…scovery + Increased UT Coverage (#434)

Co-authored-by: sakshi-garg1 <74704849+sakshi-garg1@users.noreply.github.com>
Co-authored-by: Rishabh Raj <rishabh.raj2@dell.com>
Co-authored-by: Adarsh Kumar Yadav <109620911+adarsh-dell@users.noreply.github.com>
Co-authored-by: Wilson Radadia <wilson.radadia@dell.com>
Co-authored-by: Akshay Saini <akshay.saini@dell.com>
  • Loading branch information
6 people authored Feb 18, 2025
1 parent 9447aed commit ce5fb75
Show file tree
Hide file tree
Showing 11 changed files with 937 additions and 167 deletions.
166 changes: 88 additions & 78 deletions cmd/csi-powerstore/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,25 @@ func init() {
_ = os.Setenv(gocsi.EnvVarReqLogging, "true")
_ = os.Setenv(gocsi.EnvVarRepLogging, "true")

paramsPath, ok := csictx.LookupEnv(context.Background(), common.EnvConfigParamsFilePath)
if !ok {
log.Warnf("config path X_CSI_POWERSTORE_CONFIG_PARAMS_PATH is not specified")
}
updateDriverName()

initilizeDriverConfigParams()

// If we don't set this env gocsi will overwrite log level with default Info level
_ = os.Setenv(gocsi.EnvVarLogLevel, log.GetLevel().String())
}

func updateDriverName() {
if name, ok := csictx.LookupEnv(context.Background(), common.EnvDriverName); ok {
common.Name = name
}
}

func initilizeDriverConfigParams() {
paramsPath, ok := csictx.LookupEnv(context.Background(), common.EnvConfigParamsFilePath)
if !ok {
log.Warnf("config path X_CSI_POWERSTORE_CONFIG_PARAMS_PATH is not specified")
}

paramsViper := viper.New()
paramsViper.SetConfigFile(paramsPath)
Expand All @@ -77,12 +88,6 @@ func init() {
})

updateDriverConfigParams(paramsViper)

// If we don't set this env gocsi will overwrite log level with default Info level
err = os.Setenv(gocsi.EnvVarLogLevel, log.GetLevel().String())
if err != nil {
log.WithError(err).Errorf("unable to set env variable %s", gocsi.EnvVarDebug)
}
}

func main() {
Expand Down Expand Up @@ -157,7 +162,7 @@ func main() {
}
})

interList := []grpc.UnaryServerInterceptor{
InterceptorsList := []grpc.UnaryServerInterceptor{
interceptors.NewCustomSerialLock(mode),
interceptors.NewRewriteRequestIDInterceptor(),
}
Expand All @@ -171,26 +176,31 @@ func main() {
}
defer closer.Close() // #nosec G307
opentracing.SetGlobalTracer(t)
interList = append(interList, grpc_opentracing.UnaryServerInterceptor(grpc_opentracing.WithTracer(t)))
InterceptorsList = append(InterceptorsList, grpc_opentracing.UnaryServerInterceptor(grpc_opentracing.WithTracer(t)))
}
storageProvider := &gocsi.StoragePlugin{
Controller: controllerService,
Identity: identityService,
Node: nodeService,
Interceptors: InterceptorsList,
RegisterAdditionalServers: controllerService.RegisterAdditionalServers,

EnvVars: []string{
// Enable request validation.
gocsi.EnvVarSpecReqValidation + "=true",
// Enable serial volume access.
gocsi.EnvVarSerialVolAccess + "=true",
},
}
runCSIPlugin(storageProvider)
}

var runCSIPlugin = func(storageProvider *gocsi.StoragePlugin) {
gocsi.Run(context.Background(), common.Name,
"A PowerStore Container Storage Interface (CSI) Driver",
usage,
&gocsi.StoragePlugin{
Controller: controllerService,
Identity: identityService,
Node: nodeService,
Interceptors: interList,
RegisterAdditionalServers: controllerService.RegisterAdditionalServers,

EnvVars: []string{
// Enable request validation.
gocsi.EnvVarSpecReqValidation + "=true",
// Enable serial volume access.
gocsi.EnvVarSerialVolAccess + "=true",
},
})
storageProvider,
)
}

func updateDriverConfigParams(v *viper.Viper) {
Expand Down Expand Up @@ -228,55 +238,55 @@ func updateDriverConfigParams(v *viper.Viper) {
}

const usage = `
X_CSI_POWERSTORE_INSECURE
Specifies that the PowerStore's hostname and certificate chain
should not be verified.
The default value is false.
X_CSI_POWERSTORE_NODE_ID_PATH
Specifies the name of the text file contents of which will
be appended to the node ID
X_CSI_POWERSTORE_KUBE_NODE_NAME
Specifies the name of the kubernetes node
X_CSI_POWERSTORE_NODE_NAME_PREFIX
Specifies prefix which will be used when registering node
on PowerStore array
X_CSI_POWERSTORE_NODE_CHROOT_PATH
Specifies path to chroot where to execute iSCSI commands
X_CSI_POWERSTORE_TMP_DIR
Specifies path to the folder which will be used for csi-powerstore temporary files
X_CSI_FC_PORTS_FILTER_FILE_PATH
Specifies 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 does not exist, empty or in invalid format,
then the driver will use all available FC ports
X_CSI_POWERSTORE_THROTTLING_RATE_LIMIT
Specifies a number of concurrent requests to one storage API
X_CSI_POWERSTORE_ENABLE_CHAP
Specifies whether driver should set CHAP credentials in the ISCSI
node database at the time of node plugin boot
X_CSI_POWERSTORE_EXTERNAL_ACCESS
Specifies an IP of the additional router you wish to add for nfs export
Used to provide NFS volumes behind NAT
X_CSI_POWERSTORE_CONFIG_PATH
Specifies the filepath to PowerStore arrays config file which will be used
for connection to PowerStore arrays
X_CSI_REPLICATION_CONTEXT_PREFIX
Enables sidecars to read required information from volume context
X_CSI_REPLICATION_PREFIX
Used as a prefix to find out if replication is enabled
`
X_CSI_POWERSTORE_INSECURE
Specifies that the PowerStore's hostname and certificate chain
should not be verified.
The default value is false.
X_CSI_POWERSTORE_NODE_ID_PATH
Specifies the name of the text file contents of which will
be appended to the node ID
X_CSI_POWERSTORE_KUBE_NODE_NAME
Specifies the name of the kubernetes node
X_CSI_POWERSTORE_NODE_NAME_PREFIX
Specifies prefix which will be used when registering node
on PowerStore array
X_CSI_POWERSTORE_NODE_CHROOT_PATH
Specifies path to chroot where to execute iSCSI commands
X_CSI_POWERSTORE_TMP_DIR
Specifies path to the folder which will be used for csi-powerstore temporary files
X_CSI_FC_PORTS_FILTER_FILE_PATH
Specifies 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 does not exist, empty or in invalid format,
then the driver will use all available FC ports
X_CSI_POWERSTORE_THROTTLING_RATE_LIMIT
Specifies a number of concurrent requests to one storage API
X_CSI_POWERSTORE_ENABLE_CHAP
Specifies whether driver should set CHAP credentials in the ISCSI
node database at the time of node plugin boot
X_CSI_POWERSTORE_EXTERNAL_ACCESS
Specifies an IP of the additional router you wish to add for nfs export
Used to provide NFS volumes behind NAT
X_CSI_POWERSTORE_CONFIG_PATH
Specifies the filepath to PowerStore arrays config file which will be used
for connection to PowerStore arrays
X_CSI_REPLICATION_CONTEXT_PREFIX
Enables sidecars to read required information from volume context
X_CSI_REPLICATION_PREFIX
Used as a prefix to find out if replication is enabled
`
Loading

0 comments on commit ce5fb75

Please sign in to comment.