mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-17 20:00:23 +00:00
rbd: make hasSnapshotFeature() a method of rbdVolume
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
dcbf71dd5d
commit
decfc1ae2c
@ -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())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user