mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 11:00:25 +00:00
Merge pull request #456 from Madhu-1/rbd-mount-opt
support mountflags during nodepublish in rbd
This commit is contained in:
commit
3dde768894
@ -34,3 +34,5 @@ parameters:
|
|||||||
# uncomment the following to use rbd-nbd as mounter on supported nodes
|
# uncomment the following to use rbd-nbd as mounter on supported nodes
|
||||||
# mounter: rbd-nbd
|
# mounter: rbd-nbd
|
||||||
reclaimPolicy: Delete
|
reclaimPolicy: Delete
|
||||||
|
mountOptions:
|
||||||
|
- discard
|
||||||
|
@ -144,17 +144,15 @@ func (ns *NodeServer) mountVolume(req *csi.NodePublishVolumeRequest, devicePath
|
|||||||
|
|
||||||
diskMounter := &mount.SafeFormatAndMount{Interface: ns.mounter, Exec: mount.NewOsExec()}
|
diskMounter := &mount.SafeFormatAndMount{Interface: ns.mounter, Exec: mount.NewOsExec()}
|
||||||
if isBlock {
|
if isBlock {
|
||||||
options := []string{"bind"}
|
mountFlags = append(mountFlags, "bind")
|
||||||
if err := diskMounter.Mount(devicePath, targetPath, fsType, options); err != nil {
|
if err := diskMounter.Mount(devicePath, targetPath, fsType, mountFlags); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
options := []string{}
|
|
||||||
if readOnly {
|
if readOnly {
|
||||||
options = append(options, "ro")
|
mountFlags = append(mountFlags, "ro")
|
||||||
}
|
}
|
||||||
|
if err := diskMounter.FormatAndMount(devicePath, targetPath, fsType, mountFlags); err != nil {
|
||||||
if err := diskMounter.FormatAndMount(devicePath, targetPath, fsType, options); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user