rbd: make hasSnapshotFeature() a method of rbdVolume

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-06-18 13:33:06 +02:00 committed by mergify[bot]
parent dcbf71dd5d
commit decfc1ae2c
2 changed files with 3 additions and 3 deletions

View File

@ -532,7 +532,7 @@ func (cs *ControllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
} }
// Check if source volume was created with required image features for snaps // Check if source volume was created with required image features for snaps
if !hasSnapshotFeature(rbdVol.ImageFeatures) { if !rbdVol.hasSnapshotFeature() {
return nil, status.Errorf(codes.InvalidArgument, "volume(%s) has not snapshot feature(layering)", req.GetSourceVolumeId()) return nil, status.Errorf(codes.InvalidArgument, "volume(%s) has not snapshot feature(layering)", req.GetSourceVolumeId())
} }

View File

@ -691,8 +691,8 @@ func genSnapFromOptions(ctx context.Context, rbdVol *rbdVolume, snapOptions map[
return rbdSnap return rbdSnap
} }
func hasSnapshotFeature(imageFeatures string) bool { func (rv *rbdVolume) hasSnapshotFeature() bool {
arr := strings.Split(imageFeatures, ",") arr := strings.Split(rv.ImageFeatures, ",")
for _, f := range arr { for _, f := range arr {
if f == "layering" { if f == "layering" {
return true return true