mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #67332 from nak3/ceph-fuse-opt
Automatic merge from submit-queue (batch tested with PRs 67332, 66737, 67281, 67173). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Support mount options for cephfs with ceph-fuse mount **What this PR does / why we need it**: When cephfs uses ceph-fuse for the mount command, mount option and readOnly options are disregarded. This patch adds to ceph-fuse as well. **Special notes for your reviewer**: N/A **Release note**: ```release-note NONE ```
This commit is contained in:
commit
da2169f899
@ -323,8 +323,8 @@ func (cephfsVolume *cephfs) execMount(mountpoint string) error {
|
|||||||
}
|
}
|
||||||
src += hosts[i] + ":" + cephfsVolume.path
|
src += hosts[i] + ":" + cephfsVolume.path
|
||||||
|
|
||||||
mountOptions := util.JoinMountOptions(cephfsVolume.mountOptions, opt)
|
opt = util.JoinMountOptions(cephfsVolume.mountOptions, opt)
|
||||||
if err := cephfsVolume.mounter.Mount(src, mountpoint, "ceph", mountOptions); err != nil {
|
if err := cephfsVolume.mounter.Mount(src, mountpoint, "ceph", opt); err != nil {
|
||||||
return fmt.Errorf("CephFS: mount failed: %v", err)
|
return fmt.Errorf("CephFS: mount failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,6 +408,17 @@ func (cephfsVolume *cephfs) execFuseMount(mountpoint string) error {
|
|||||||
mountArgs = append(mountArgs, "--id")
|
mountArgs = append(mountArgs, "--id")
|
||||||
mountArgs = append(mountArgs, cephfsVolume.id)
|
mountArgs = append(mountArgs, cephfsVolume.id)
|
||||||
|
|
||||||
|
// build option array
|
||||||
|
opt := []string{}
|
||||||
|
if cephfsVolume.readonly {
|
||||||
|
opt = append(opt, "ro")
|
||||||
|
}
|
||||||
|
opt = util.JoinMountOptions(cephfsVolume.mountOptions, opt)
|
||||||
|
if len(opt) > 0 {
|
||||||
|
mountArgs = append(mountArgs, "-o")
|
||||||
|
mountArgs = append(mountArgs, strings.Join(opt, ","))
|
||||||
|
}
|
||||||
|
|
||||||
glog.V(4).Infof("Mounting cmd ceph-fuse with arguments (%s)", mountArgs)
|
glog.V(4).Infof("Mounting cmd ceph-fuse with arguments (%s)", mountArgs)
|
||||||
command := exec.Command("ceph-fuse", mountArgs...)
|
command := exec.Command("ceph-fuse", mountArgs...)
|
||||||
output, err := command.CombinedOutput()
|
output, err := command.CombinedOutput()
|
||||||
|
Loading…
Reference in New Issue
Block a user