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