Skip to content

Commit

Permalink
Advertise the NODE STAGE and UNSTAGE capability in the ISCSI server
Browse files Browse the repository at this point in the history
This commit also add the `Lun` info to the connector

Signed-off-by: Humble Chirammal <[email protected]>
  • Loading branch information
humblec committed Nov 25, 2021
1 parent 0b52e59 commit 71af081
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/iscsi/iscsi.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func buildISCSIConnector(iscsiInfo *iscsiDisk) *iscsiLib.Connector {
VolumeName: iscsiInfo.VolName,
TargetIqn: iscsiInfo.Iqn,
TargetPortals: iscsiInfo.Portals,
Lun: iscsiInfo.lun,
}

if iscsiInfo.sessionSecret != (iscsiLib.Secrets{}) {
Expand Down
19 changes: 18 additions & 1 deletion pkg/iscsi/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,27 @@ func (ns *nodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpu
}

func (ns *nodeServer) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error) {
if req.GetVolumeId() == "" {
return nil, status.Error(codes.InvalidArgument, "volume ID missing in request")
}

if req.GetStagingTargetPath() == "" {
return nil, status.Error(codes.InvalidArgument, "staging target path missing in request")
}
return &csi.NodeUnstageVolumeResponse{}, nil
}

func (ns *nodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error) {
if req.GetVolumeCapability() == nil {
return nil, status.Error(codes.InvalidArgument, "Volume capability missing in request")
}
if len(req.GetVolumeId()) == 0 {
return nil, status.Error(codes.InvalidArgument, "Volume ID missing in request")
}
if req.GetStagingTargetPath() == "" {
return nil, status.Error(codes.InvalidArgument, "staging target path missing in request")
}

return &csi.NodeStageVolumeResponse{}, nil
}

Expand All @@ -89,7 +106,7 @@ func (ns *nodeServer) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetC
{
Type: &csi.NodeServiceCapability_Rpc{
Rpc: &csi.NodeServiceCapability_RPC{
Type: csi.NodeServiceCapability_RPC_UNKNOWN,
Type: csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
},
},
},
Expand Down

0 comments on commit 71af081

Please sign in to comment.