mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
rbd: use helper functions from csi-common for VolumeCapability checking
The internal/csi-common package offers helper functions like `IsReaderOnly()` and `IsBlockMultiNode()`. These should be used instead of checking the VolumeCapability that is passed in a request in different places. This also suggested that adding the "ro" mount option in `NodeServer.mountVolumeToStagePath()` is not appropriate, as the csi-common helper `ConstructMountOptions()` can take care of that already too. Signed-off-by: Niels de Vos <ndevos@ibm.com>
This commit is contained in:
committed by
mergify[bot]
parent
34be059dd5
commit
ea7be34396
@ -93,6 +93,14 @@ func ConstructMountOptions(mountOptions []string, volCap *csi.VolumeCapability)
|
||||
}
|
||||
}
|
||||
|
||||
// add "ro" in case the capabilities indicate READER_ONLY
|
||||
rOnly := "ro"
|
||||
if IsReaderOnly([]*csi.VolumeCapability{volCap}) {
|
||||
if !MountOptionContains(mountOptions, rOnly) {
|
||||
mountOptions = append(mountOptions, rOnly)
|
||||
}
|
||||
}
|
||||
|
||||
return mountOptions
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user