mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 18:53:35 +00:00
rbd: detect krbd features in runtime and fallback to nbd
Currently, we recognize and warn for the provided image features based on our prior intelligence at ceph-csi (i.e based on supportedFeatures map and validateImageFeatures) at image/PV creation time. It might be very much possible that the cluster is heterogeneous i.e. the PV creation and application container might both be on different nodes with different kernel versions (krbd driver versions). This PR adds a mechanism to check for the supported krbd features during mount time, if the krbd driver doesn't have the specified image feature then it will fall back to rbd-nbd mounter. Fixes: #478 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
af752dd38f
commit
84ec797dda
@ -226,10 +226,22 @@ func populateRbdVol(
|
||||
rv.RbdImageName = imageAttributes.ImageName
|
||||
}
|
||||
|
||||
krbdSupported := false
|
||||
if req.GetVolumeContext()["mounter"] != rbdNbdMounter {
|
||||
krbdSupported = isKrbdFeatureSupported(ctx, req.GetVolumeContext()["imageFeatures"])
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
rv.VolID = volID
|
||||
rv.MapOptions = req.GetVolumeContext()["mapOptions"]
|
||||
rv.UnmapOptions = req.GetVolumeContext()["unmapOptions"]
|
||||
rv.Mounter = req.GetVolumeContext()["mounter"]
|
||||
|
||||
rv.LogDir = req.GetVolumeContext()["cephLogDir"]
|
||||
if rv.LogDir == "" {
|
||||
rv.LogDir = defaultLogDir
|
||||
|
Reference in New Issue
Block a user