diff --git a/service/controller.go b/service/controller.go index 9e3e5162..9a007d06 100644 --- a/service/controller.go +++ b/service/controller.go @@ -2254,6 +2254,10 @@ func valVolumeCaps( break case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER: break + case csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER: + break + case csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER: + break case csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY: break case csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY: @@ -2430,6 +2434,13 @@ func (s *service) ControllerGetCapabilities( }, }, }, + { + Type: &csi.ControllerServiceCapability_Rpc{ + Rpc: &csi.ControllerServiceCapability_RPC{ + Type: csi.ControllerServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER, + }, + }, + }, }, }, nil } diff --git a/service/mount.go b/service/mount.go index 3d453b8e..91c3481b 100644 --- a/service/mount.go +++ b/service/mount.go @@ -376,7 +376,9 @@ func handlePrivFSMount( return status.Errorf(codes.Internal, "error performing private mount: %s", err.Error()) } return nil - } else if accMode.GetMode() == csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER { + } else if (accMode.GetMode() == csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER) || + (accMode.GetMode() == csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER) || + (accMode.GetMode() == csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER) { if err := gofsutil.FormatAndMount(formatCtx, sysDevice.FullPath, privTgt, fs, mntFlags...); err != nil { return status.Errorf(codes.Internal, "error performing private mount: %s", err.Error()) } @@ -663,7 +665,9 @@ func validateVolumeCapability(volCap *csi.VolumeCapability, readOnly bool) (bool switch accMode.GetMode() { case csi.VolumeCapability_AccessMode_UNKNOWN: return true, mntVol, accMode, "", status.Error(codes.InvalidArgument, "Unknown Access Mode") - case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER: + case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER: case csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY: case csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY: multiAccessFlag = "ro" @@ -681,7 +685,9 @@ func validateVolumeCapability(volCap *csi.VolumeCapability, readOnly bool) (bool switch accMode.GetMode() { case csi.VolumeCapability_AccessMode_UNKNOWN: return false, mntVol, accMode, "", status.Error(codes.InvalidArgument, "Unknown Access Mode") - case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER: + case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER: case csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY: case csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY: multiAccessFlag = "ro" @@ -697,10 +703,13 @@ func validateVolumeCapability(volCap *csi.VolumeCapability, readOnly bool) (bool return isBlock, mntVol, accMode, multiAccessFlag, nil } -// singleAccessMode returns true if only a single access is allowed SINGLE_NODE_WRITER or SINGLE_NODE_READER_ONLY +// singleAccessMode returns true if only a single access is allowed SINGLE_NODE_WRITER, SINGLE_NODE_SINGLE_WRITER, +// SINGLE_NODE_MULTI_WRITER or SINGLE_NODE_READER_ONLY func singleAccessMode(accMode *csi.VolumeCapability_AccessMode) bool { switch accMode.GetMode() { - case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER: + case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER: return true case csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY: return true diff --git a/service/node.go b/service/node.go index 2cbbb433..65f6fd55 100644 --- a/service/node.go +++ b/service/node.go @@ -740,6 +740,13 @@ func (s *service) NodeGetCapabilities( }, }, }, + { + Type: &csi.NodeServiceCapability_Rpc{ + Rpc: &csi.NodeServiceCapability_RPC{ + Type: csi.NodeServiceCapability_RPC_SINGLE_NODE_MULTI_WRITER, + }, + }, + }, }, }, nil } diff --git a/service/storage_group_svc.go b/service/storage_group_svc.go index 0b81e43b..d973d160 100644 --- a/service/storage_group_svc.go +++ b/service/storage_group_svc.go @@ -518,6 +518,8 @@ func (g *storageGroupSvc) addVolumeToSGMVVolumeCheck(ctx context.Context, client } switch am.Mode { case csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_SINGLE_WRITER, + csi.VolumeCapability_AccessMode_SINGLE_NODE_MULTI_WRITER, csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY: // Check if the volume is already mapped to some host if vol.NumberOfFrontEndPaths > 0 {