cephfs: trim spaces around fuseMountOptions

When passing

    fuseMountOptions: debug

in the StorageClass, the mount options passed on the ceph-fuse
commandline result in "-o nonempty ,debug". The additional space before
the ",debug" causes the mount command to fail.

Fixes: 1485
Signed-off-by: Niels de Vos <ndevos@redhat.com>
(cherry picked from commit 6f2f972f5b)
This commit is contained in:
Niels de Vos 2020-09-21 14:04:25 +02:00 committed by mergify[bot]
parent bef4873049
commit b810ca57a0

View File

@ -154,12 +154,13 @@ func mountFuse(ctx context.Context, mountPoint string, cr *util.Credentials, vol
"-c", util.CephConfigPath,
"-n", cephEntityClientPrefix + cr.ID, "--keyfile=" + cr.KeyFile,
"-r", volOptions.RootPath,
"-o", "nonempty",
}
fmo := "nonempty"
if volOptions.FuseMountOptions != "" {
args = append(args, ","+volOptions.FuseMountOptions)
fmo += "," + strings.TrimSpace(volOptions.FuseMountOptions)
}
args = append(args, "-o", fmo)
if volOptions.FsName != "" {
args = append(args, "--client_mds_namespace="+volOptions.FsName)