rbd: provide a way to disable the auto fallback to nbd mounter

This change allows the user to choose not to fallback to NBD mounter
when some ImageFeatures are absent with krbd driver, rather just fail
the NodeStage call.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever
2021-10-05 16:17:11 +05:30
committed by mergify[bot]
parent bfc24f6f12
commit 9a3170bf77
6 changed files with 31 additions and 3 deletions

View File

@ -68,8 +68,9 @@ const (
xfsReflinkNoSupport
xfsReflinkSupport
staticVol = "staticVolume"
volHealerCtx = "volumeHealerContext"
staticVol = "staticVolume"
volHealerCtx = "volumeHealerContext"
tryOtherMounters = "tryOtherMounters"
)
var (
@ -218,6 +219,11 @@ func populateRbdVol(
krbdSupported := false
if req.GetVolumeContext()["mounter"] != rbdNbdMounter {
krbdSupported = isKrbdFeatureSupported(ctx, req.GetVolumeContext()["imageFeatures"])
if !krbdSupported && !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"]