check snapshot feature

This commit is contained in:
Seungcheol Ko
2018-08-09 22:07:13 +09:00
parent 4312907f7b
commit 38aa575925
2 changed files with 14 additions and 0 deletions

View File

@ -236,6 +236,10 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
if err != nil {
return nil, status.Error(codes.NotFound, fmt.Sprintf("Source Volume ID %s cannot found", req.GetSourceVolumeId()))
}
if !hasSnapshotFeature(rbdVolume.ImageFeatures) {
return nil, fmt.Errorf("Volume(%s) has not snapshot feature(layering)", req.GetSourceVolumeId())
}
rbdSnap.VolName = rbdVolume.VolName
rbdSnap.SnapName = snapName
snapshotID := "csi-rbd-" + rbdVolume.VolName + "-snap-" + uniqueID