mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
rbd: handle when krbdFeatures is zero
krbdFeatures is set to zero when kernel version < 3.8, i.e. in case where /sys/bus/rbd/supported_features is absent and we are unable to prepare the krbd attributes based on kernel version. When krbdFeatures is set to zero fallback to NBD only when autofallback is turned ON. Fixes: #2678 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
e53fd87154
commit
83cc1b0e58
@ -328,7 +328,12 @@ func HexStringToInteger(hexString string) (uint, error) {
|
||||
|
||||
// isKrbdFeatureSupported checks if a given Image Feature is supported by krbd
|
||||
// driver or not.
|
||||
func isKrbdFeatureSupported(ctx context.Context, imageFeatures string) bool {
|
||||
func isKrbdFeatureSupported(ctx context.Context, imageFeatures string) (bool, error) {
|
||||
// return false when /sys/bus/rbd/supported_features is absent and we are
|
||||
// not in a position to prepare krbd feature attributes, i.e. if kernel <= 3.8
|
||||
if krbdFeatures == 0 {
|
||||
return false, os.ErrNotExist
|
||||
}
|
||||
arr := strings.Split(imageFeatures, ",")
|
||||
log.UsefulLog(ctx, "checking for ImageFeatures: %v", arr)
|
||||
imageFeatureSet := librbd.FeatureSetFromNames(arr)
|
||||
@ -343,7 +348,7 @@ func isKrbdFeatureSupported(ctx context.Context, imageFeatures string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
return supported
|
||||
return supported, nil
|
||||
}
|
||||
|
||||
// Connect an rbdVolume to the Ceph cluster.
|
||||
|
Reference in New Issue
Block a user