mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rbd: use librbd.FeatureSet for features
go-ceph v0.3 adds constants for ImageFeature values and their names. Instead of hardcoding "layering" in several places, use the constant given by librbd. The rbdVolume.ImageFeatures does not seem to be used anywhere after the conversion. Stashing the image metadata does include the ImageFeatures as these are retrieved when getting the image information. It is safe to drop ImageFeatures altogether and only use the imageFeatureSet instead. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
decfc1ae2c
commit
da40d8e05e
@ -17,7 +17,10 @@ limitations under the License.
|
||||
package rbd
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
librbd "github.com/ceph/go-ceph/rbd"
|
||||
)
|
||||
|
||||
func TestIsLegacyVolumeID(t *testing.T) {
|
||||
@ -48,8 +51,11 @@ func TestHasSnapshotFeature(t *testing.T) {
|
||||
{"foo,layering,bar", true},
|
||||
}
|
||||
|
||||
rv := rbdVolume{}
|
||||
|
||||
for _, test := range tests {
|
||||
if got := hasSnapshotFeature(test.features); got != test.hasFeature {
|
||||
rv.imageFeatureSet = librbd.FeatureSetFromNames(strings.Split(test.features, ","))
|
||||
if got := rv.hasSnapshotFeature(); got != test.hasFeature {
|
||||
t.Errorf("hasSnapshotFeature(%s) = %t, want %t", test.features, got, test.hasFeature)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user