Skip to content

Commit

Permalink
PWX-33879: Add support for RWOP access mode
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Griffiths <[email protected]>
  • Loading branch information
Grant Griffiths committed Sep 21, 2023
1 parent fb0df1e commit c2412c9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions csi/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ func (s *OsdCsiServer) ControllerGetCapabilities(

// GetCapacity
csi.ControllerServiceCapability_RPC_GET_CAPACITY,

// SINGLE_NODE_MULTI_WRITER Capability for RWOP access mode
csi.ControllerServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER,
}

var serviceCapabilities []*csi.ControllerServiceCapability
Expand Down
3 changes: 2 additions & 1 deletion csi/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestControllerGetCapabilities(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, resp)

assert.Len(t, resp.GetCapabilities(), 8)
assert.Len(t, resp.GetCapabilities(), 9)
assert.True(t, containsCap(csi.ControllerServiceCapability_RPC_GET_VOLUME, resp))
assert.True(t, containsCap(csi.ControllerServiceCapability_RPC_CLONE_VOLUME, resp))
assert.True(t, containsCap(csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME, resp))
Expand All @@ -86,6 +86,7 @@ func TestControllerGetCapabilities(t *testing.T) {
assert.True(t, containsCap(csi.ControllerServiceCapability_RPC_LIST_SNAPSHOTS, resp))
assert.True(t, containsCap(csi.ControllerServiceCapability_RPC_VOLUME_CONDITION, resp))
assert.True(t, containsCap(csi.ControllerServiceCapability_RPC_GET_CAPACITY, resp))
assert.True(t, containsCap(csi.ControllerServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER, resp))

assert.False(t, containsCap(csi.ControllerServiceCapability_RPC_UNKNOWN, resp))
}
Expand Down
2 changes: 1 addition & 1 deletion csi/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (s *OsdCsiServer) NodeGetInfo(
// target path on the node.
//
// TODO: Support READ ONLY Mounts
//
func (s *OsdCsiServer) NodePublishVolume(
ctx context.Context,
req *csi.NodePublishVolumeRequest,
Expand Down Expand Up @@ -297,6 +296,7 @@ func (s *OsdCsiServer) NodeGetCapabilities(
csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
// Indicates that the Node service can report volume conditions.
csi.NodeServiceCapability_RPC_VOLUME_CONDITION,
csi.NodeServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER,
}

var serviceCapabilities []*csi.NodeServiceCapability
Expand Down
6 changes: 5 additions & 1 deletion csi/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ func TestNodeGetCapabilities(t *testing.T) {
context.Background(),
&csi.NodeGetCapabilitiesRequest{})
assert.NoError(t, err)
assert.Len(t, r.GetCapabilities(), 2)
assert.Len(t, r.GetCapabilities(), 3)
assert.Equal(
t,
csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
Expand All @@ -1056,6 +1056,10 @@ func TestNodeGetCapabilities(t *testing.T) {
t,
csi.NodeServiceCapability_RPC_VOLUME_CONDITION,
r.GetCapabilities()[1].GetRpc().GetType())
assert.Equal(
t,
csi.NodeServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER,
r.GetCapabilities()[2].GetRpc().GetType())
}

func TestNodeGetVolumeStats(t *testing.T) {
Expand Down

0 comments on commit c2412c9

Please sign in to comment.