mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-27 08:40:23 +00:00
rbd: allow readonly only for volume with contentsource
It doesnot make sense to allow the creation of empty
volumes which is going to be accessed with readonly mode,
this commit allows the creation of volume which is having
readonly capabilities only if the content source is set
for the volume.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 2deabcd284
)
This commit is contained in:
parent
c9601189ef
commit
5a7e188bb4
@ -80,6 +80,13 @@ func (cs *ControllerServer) validateVolumeReq(ctx context.Context, req *csi.Crea
|
|||||||
if value, ok := options["volumeNamePrefix"]; ok && value == "" {
|
if value, ok := options["volumeNamePrefix"]; ok && value == "" {
|
||||||
return status.Error(codes.InvalidArgument, "empty volume name prefix to provision volume from")
|
return status.Error(codes.InvalidArgument, "empty volume name prefix to provision volume from")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Allow readonly access mode for volume with content source
|
||||||
|
err := util.CheckReadOnlyManyIsSupported(req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user