rbd: provide a way to supply mounter specific mapOptions from sc

Uses the below schema to supply mounter specific map/unmapOptions to the
nodeplugin based on the discussion we all had at
https://github.com/ceph/ceph-csi/pull/2636

This should specifically be really helpful with the `tryOthermonters`
set to true, i.e with fallback mechanism settings turned ON.

mapOption: "kbrd:v1,v2,v3;nbd:v1,v2,v3"

- By omitting `krbd:` or `nbd:`, the option(s) apply to
  rbdDefaultMounter which is krbd.
- A user can _override_ the options for a mounter by specifying `krbd:`
  or `nbd:`.
  mapOption: "v1,v2,v3;nbd:v1,v2,v3"
  is effectively the same as the 1st example.
- Sections are split by `;`.
- If users want to specify common options for both `krbd` and `nbd`,
  they should mention them twice.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever
2021-11-16 18:40:11 +05:30
committed by mergify[bot]
parent b2099eb3b1
commit bdcf3273b5
3 changed files with 164 additions and 3 deletions

View File

@ -224,12 +224,14 @@ func populateRbdVol(
return nil, status.Errorf(codes.Internal, "unsupported krbd Feature")
}
// 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"]
}
err = getMapOptions(req, rv)
if err != nil {
return nil, err
}
rv.VolID = volID