Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions driver/csiplugin/gpfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type ScaleDriver struct {
ids *ScaleIdentityServer
ns *ScaleNodeServer
cs *ScaleControllerServer
gcs *ScaleGroupControllerServer

connmap map[string]connectors.SpectrumScaleConnector
cmap settings.ScaleSettingsConfigMap
Expand All @@ -115,9 +116,10 @@ type ScaleDriver struct {
// clusterMap map stores the cluster name as key and cluster details as value.
clusterMap sync.Map

vcap []*csi.VolumeCapability_AccessMode
cscap []*csi.ControllerServiceCapability
nscap []*csi.NodeServiceCapability
vcap []*csi.VolumeCapability_AccessMode
cscap []*csi.ControllerServiceCapability
nscap []*csi.NodeServiceCapability
gcscap []*csi.GroupControllerServiceCapability
}

func GetScaleDriver(ctx context.Context) *ScaleDriver {
Expand Down Expand Up @@ -150,6 +152,13 @@ func NewNodeServer(ctx context.Context, d *ScaleDriver) *ScaleNodeServer {
}
}

func NewGroupControllerServer(ctx context.Context, d *ScaleDriver) *ScaleGroupControllerServer {
klog.V(4).Infof("[%s] Starting NewGroupControllerServer", utils.GetLoggerId(ctx))
return &ScaleGroupControllerServer{
Driver: d,
}
}

func (driver *ScaleDriver) AddVolumeCapabilityAccessModes(ctx context.Context, vc []csi.VolumeCapability_AccessMode_Mode) error {
klog.V(4).Infof("[%s] AddVolumeCapabilityAccessModes", utils.GetLoggerId(ctx))
var vca []*csi.VolumeCapability_AccessMode
Expand Down Expand Up @@ -183,6 +192,17 @@ func (driver *ScaleDriver) AddNodeServiceCapabilities(ctx context.Context, nl []
return nil
}

func (driver *ScaleDriver) AddGroupControllerServiceCapabilities(ctx context.Context, nl []csi.GroupControllerServiceCapability_RPC_Type) error {
klog.V(4).Infof("[%s] AddGroupControllerServiceCapabilities", utils.GetLoggerId(ctx))
var gcs []*csi.GroupControllerServiceCapability
for _, n := range nl {
klog.V(4).Infof("[%s] Enabling group controller service capability: %v", utils.GetLoggerId(ctx), n.String())
gcs = append(gcs, NewGroupControllerServiceCapability(n))
}
driver.gcscap = gcs
return nil
}

func (driver *ScaleDriver) ValidateControllerServiceRequest(ctx context.Context, c csi.ControllerServiceCapability_RPC_Type) error {
klog.Infof("[%s] ValidateControllerServiceRequest", utils.GetLoggerId(ctx))
if c == csi.ControllerServiceCapability_RPC_UNKNOWN {
Expand Down Expand Up @@ -237,9 +257,15 @@ func (driver *ScaleDriver) SetupScaleDriver(ctx context.Context, name, vendorVer
}
_ = driver.AddNodeServiceCapabilities(ctx, ns)

gsc := []csi.GroupControllerServiceCapability_RPC_Type{
csi.GroupControllerServiceCapability_RPC_CREATE_DELETE_GET_VOLUME_GROUP_SNAPSHOT,
}
_ = driver.AddGroupControllerServiceCapabilities(ctx, gsc)

driver.ids = NewIdentityServer(ctx, driver)
driver.ns = NewNodeServer(ctx, driver)
driver.cs = NewControllerServer(ctx, driver, scmap, cmap, primary)
driver.gcs = NewGroupControllerServer(ctx, driver)
return nil
}

Expand Down Expand Up @@ -287,7 +313,7 @@ func (driver *ScaleDriver) PluginInitialize(ctx context.Context) (map[string]con

func (driver *ScaleDriver) Run(ctx context.Context, endpoint string) {
s := NewNonBlockingGRPCServer()
s.Start(endpoint, driver.ids, driver.cs, driver.ns)
s.Start(endpoint, driver.ids, driver.cs, driver.ns, driver.gcs)
s.Wait()
}

Expand Down
Loading