mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +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
@ -18,6 +18,7 @@ package rbd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
@ -346,8 +347,13 @@ func TestIsKrbdFeatureSupported(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("HexStringToInteger(%s) failed", krbdSupportedFeaturesAttr)
|
||||
}
|
||||
supported := isKrbdFeatureSupported(ctx, tc.featureName)
|
||||
if supported != tc.isSupported {
|
||||
// In case /sys/bus/rbd/supported_features is absent and we are
|
||||
// not in a position to prepare krbd feature attributes,
|
||||
// isKrbdFeatureSupported returns error ErrNotExist
|
||||
supported, err := isKrbdFeatureSupported(ctx, tc.featureName)
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
t.Errorf("isKrbdFeatureSupported(%s) returned error: %v", tc.featureName, err)
|
||||
} else if supported != tc.isSupported {
|
||||
t.Errorf("isKrbdFeatureSupported(%s) returned supported status, expected: %t, got: %t",
|
||||
tc.featureName, tc.isSupported, supported)
|
||||
}
|
||||
|
Reference in New Issue
Block a user