Skip to content

Commit

Permalink
rbd: fix mapOptions passing with rbd-nbd mounter
Browse files Browse the repository at this point in the history
This was a regression introduced by:
#2556

Fixes: #2610
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
  • Loading branch information
Prasanna Kumar Kalever authored and mergify[bot] committed Nov 16, 2021
1 parent cee6da5 commit e6fa392
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions internal/rbd/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e6fa392

Please sign in to comment.