mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
Add _netdev as default mount options in plugin
This values will be added at both nodestage
and nodepublish for rbd, nbd and ceph kernel client.
As cephfs fuse doesnot support this value,
this is added only during the nodepublish.
Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
(cherry picked from commit 881f59d142
)
This commit is contained in:
committed by
mergify[bot]
parent
a1c5e6b250
commit
5a3d439137
@ -331,7 +331,7 @@ func (ns *NodeServer) mountVolumeToStagePath(ctx context.Context, req *csi.NodeS
|
||||
}
|
||||
}
|
||||
|
||||
opt := []string{}
|
||||
opt := []string{"_netdev"}
|
||||
isBlock := req.GetVolumeCapability().GetBlock() != nil
|
||||
|
||||
if isBlock {
|
||||
@ -350,16 +350,19 @@ func (ns *NodeServer) mountVolume(ctx context.Context, stagingPath string, req *
|
||||
// Publish Path
|
||||
fsType := req.GetVolumeCapability().GetMount().GetFsType()
|
||||
readOnly := req.GetReadonly()
|
||||
mountFlags := req.GetVolumeCapability().GetMount().GetMountFlags()
|
||||
mountOptions := []string{"bind", "_netdev"}
|
||||
isBlock := req.GetVolumeCapability().GetBlock() != nil
|
||||
targetPath := req.GetTargetPath()
|
||||
|
||||
mountOptions = csicommon.ConstructMountOptions(mountOptions, req.GetVolumeCapability())
|
||||
|
||||
klog.V(4).Infof(util.Log(ctx, "target %v\nisBlock %v\nfstype %v\nstagingPath %v\nreadonly %v\nmountflags %v\n"),
|
||||
targetPath, isBlock, fsType, stagingPath, readOnly, mountFlags)
|
||||
mountFlags = append(mountFlags, "bind")
|
||||
targetPath, isBlock, fsType, stagingPath, readOnly, mountOptions)
|
||||
|
||||
if readOnly {
|
||||
mountFlags = append(mountFlags, "ro")
|
||||
mountOptions = append(mountOptions, "ro")
|
||||
}
|
||||
if err := util.Mount(stagingPath, targetPath, fsType, mountFlags); err != nil {
|
||||
if err := util.Mount(stagingPath, targetPath, fsType, mountOptions); err != nil {
|
||||
return status.Error(codes.Internal, err.Error())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user