mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-27 08:40:23 +00:00
util: add helper to validate ROX request
added a helper function to validate is create
request for ROX is for volume from source.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit d816df4f42
)
This commit is contained in:
parent
90da7961c5
commit
c9601189ef
@ -78,3 +78,16 @@ func ValidateNodeUnpublishVolumeRequest(req *csi.NodeUnpublishVolumeRequest) err
|
|||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckReadOnlyManyIsSupported checks the request is to create ReadOnlyMany
|
||||||
|
// volume is from source as empty ReadOnlyMany is not supported.
|
||||||
|
func CheckReadOnlyManyIsSupported(req *csi.CreateVolumeRequest) error {
|
||||||
|
for _, cap := range req.GetVolumeCapabilities() {
|
||||||
|
if m := cap.GetAccessMode().Mode; m == csi.VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY || m == csi.VolumeCapability_AccessMode_SINGLE_NODE_READER_ONLY {
|
||||||
|
if req.GetVolumeContentSource() == nil {
|
||||||
|
return status.Error(codes.InvalidArgument, "readOnly accessMode is supported only with content source")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user