From e6fa392df179b81559ad8bebd39464a5cbf76056 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Sun, 14 Nov 2021 14:33:01 +0530 Subject: [PATCH] rbd: fix mapOptions passing with rbd-nbd mounter This was a regression introduced by: https://github.com/ceph/ceph-csi/pull/2556 Fixes: #2610 Signed-off-by: Prasanna Kumar Kalever --- internal/rbd/nodeserver.go | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index b14a381b9..1b5214a53 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -216,23 +216,20 @@ func populateRbdVol( rv.RbdImageName = imageAttributes.ImageName } - krbdSupported := false - if req.GetVolumeContext()["mounter"] != rbdNbdMounter { - krbdSupported = isKrbdFeatureSupported(ctx, req.GetVolumeContext()["imageFeatures"]) - if !krbdSupported && !parseBoolOption(ctx, req.GetVolumeContext(), tryOtherMounters, false) { + if req.GetVolumeContext()["mounter"] == rbdDefaultMounter && + !isKrbdFeatureSupported(ctx, req.GetVolumeContext()["imageFeatures"]) { + if !parseBoolOption(ctx, req.GetVolumeContext(), tryOtherMounters, false) { log.ErrorLog(ctx, "unsupported krbd Feature, set `tryOtherMounters:true` or fix krbd driver") return nil, status.Errorf(codes.Internal, "unsupported krbd Feature") } - } - if krbdSupported { - rv.MapOptions = req.GetVolumeContext()["mapOptions"] - rv.UnmapOptions = req.GetVolumeContext()["unmapOptions"] - rv.Mounter = req.GetVolumeContext()["mounter"] - } else { // fallback to rbd-nbd, // ignore the mapOptions and unmapOptions as they are meant for krbd use. rv.Mounter = rbdNbdMounter + } else { + rv.Mounter = req.GetVolumeContext()["mounter"] + rv.MapOptions = req.GetVolumeContext()["mapOptions"] + rv.UnmapOptions = req.GetVolumeContext()["unmapOptions"] } rv.VolID = volID