Skip to content

Commit

Permalink
Support enable spdk or disable.
Browse files Browse the repository at this point in the history
  • Loading branch information
VinceCui committed Jul 5, 2023
1 parent 9aa487f commit 75de500
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/csi/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func Start(opt *csiOption) error {
csi.WithLocalClient(localclient),
csi.WithDriverMode(opt.DriverMode),
csi.WithUseNodeHostname(opt.UseNodeHostname),
csi.WithEnableSpdk(opt.EnableSpdk),
)
if err := driver.Run(); err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions cmd/csi/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type csiOption struct {
CgroupDriver string
DriverMode string
UseNodeHostname bool
EnableSpdk bool
ExtenderSchedulerNames []string
FrameworkSchedulerNames []string
}
Expand All @@ -49,6 +50,7 @@ func (option *csiOption) addFlags(fs *pflag.FlagSet) {
fs.StringVar(&option.CgroupDriver, "cgroupDriver", "systemd", "the name of cgroup driver")
fs.StringVar(&option.DriverMode, "driver-mode", "all", "driver mode")
fs.BoolVar(&option.UseNodeHostname, "use-node-hostname", false, "use node hostname dns for grpc connection")
fs.BoolVar(&option.EnableSpdk, "enable-spdk", true, "enable spdk or not")
fs.StringSliceVar(&option.ExtenderSchedulerNames, "extender-scheduler-names", []string{"default-scheduler"}, "extender scheduler names")
fs.StringSliceVar(&option.FrameworkSchedulerNames, "framework-scheduler-names", []string{}, "framework scheduler names")
}
7 changes: 7 additions & 0 deletions pkg/csi/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type driverOptions struct {
grpcConnectionTimeout int
mode string
useNodeHostname bool
enableSpdk bool
extenderSchedulerNames []string
frameworkSchedulerNames []string

Expand Down Expand Up @@ -170,6 +171,12 @@ func WithUseNodeHostname(useNodeHostname bool) Option {
}
}

func WithEnableSpdk(enableSpdk bool) Option {
return func(o *driverOptions) {
o.enableSpdk = enableSpdk
}
}

func WithExtenderSchedulerNames(extenderSchedulerNames []string) Option {
return func(o *driverOptions) {
o.extenderSchedulerNames = extenderSchedulerNames
Expand Down
4 changes: 3 additions & 1 deletion pkg/csi/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ func newNodeServer(options *driverOptions) *nodeServer {
options: options,
}

go ns.checkSPDKSupport()
if options.enableSpdk {
go ns.checkSPDKSupport()
}

return ns
}
Expand Down

0 comments on commit 75de500

Please sign in to comment.