From b3d088bb0012b0887676d5f837499e87b906fa88 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Wed, 4 May 2022 14:27:18 +0530 Subject: [PATCH] rbd: consider rbd as default mounter if not set For the default mounter the mounter option will not be set in the storageclass and as it is not available in the storageclass same will not be set in the volume context, Because of this the mapOptions are getting discarded. If the mounter is not set assuming it's an rbd mounter. Note:- If the mounter is not set in the storageclass we can set it in the volume context explicitly, Doing this check-in node server to support backward existing volumes and the check is minimal we are not altering the volume context. fixes: #3076 Signed-off-by: Madhu Rajanna --- internal/rbd/nodeserver.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/rbd/nodeserver.go b/internal/rbd/nodeserver.go index 3ac153f44304..20dc8459e29d 100644 --- a/internal/rbd/nodeserver.go +++ b/internal/rbd/nodeserver.go @@ -241,7 +241,11 @@ func populateRbdVol( return nil, status.Error(codes.Internal, err.Error()) } - if req.GetVolumeContext()["mounter"] == rbdDefaultMounter && + mounter := req.GetVolumeContext()["mounter"] + if mounter == "" { + mounter = rbdDefaultMounter + } + if mounter == rbdDefaultMounter && !isKrbdFeatureSupported(ctx, strings.Join(rv.ImageFeatureSet.Names(), ",")) { if !parseBoolOption(ctx, req.GetVolumeContext(), tryOtherMounters, false) { log.ErrorLog(ctx, "unsupported krbd Feature, set `tryOtherMounters:true` or fix krbd driver") @@ -252,7 +256,7 @@ func populateRbdVol( // fallback to rbd-nbd, rv.Mounter = rbdNbdMounter } else { - rv.Mounter = req.GetVolumeContext()["mounter"] + rv.Mounter = mounter } err = getMapOptions(req, rv)