From decfc1ae2cf6b571bd191905e1fd388493eeed1f Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Thu, 18 Jun 2020 13:33:06 +0200 Subject: [PATCH] rbd: make hasSnapshotFeature() a method of rbdVolume Signed-off-by: Niels de Vos --- internal/rbd/controllerserver.go | 2 +- internal/rbd/rbd_util.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/rbd/controllerserver.go b/internal/rbd/controllerserver.go index 1ac3f95fb..060399e33 100644 --- a/internal/rbd/controllerserver.go +++ b/internal/rbd/controllerserver.go @@ -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 - if !hasSnapshotFeature(rbdVol.ImageFeatures) { + if !rbdVol.hasSnapshotFeature() { return nil, status.Errorf(codes.InvalidArgument, "volume(%s) has not snapshot feature(layering)", req.GetSourceVolumeId()) } diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 9bbf19499..5857ddd3e 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -691,8 +691,8 @@ func genSnapFromOptions(ctx context.Context, rbdVol *rbdVolume, snapOptions map[ return rbdSnap } -func hasSnapshotFeature(imageFeatures string) bool { - arr := strings.Split(imageFeatures, ",") +func (rv *rbdVolume) hasSnapshotFeature() bool { + arr := strings.Split(rv.ImageFeatures, ",") for _, f := range arr { if f == "layering" { return true