Merge pull request #110 from pohly/block-volume-mode-check

rbd: refuse to create block volumes
This commit is contained in:
Róbert Vašek 2019-01-09 08:49:20 +01:00 committed by GitHub
commit 3170ec455c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,11 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
if req.VolumeCapabilities == nil { if req.VolumeCapabilities == nil {
return nil, status.Error(codes.InvalidArgument, "Volume Capabilities cannot be empty") return nil, status.Error(codes.InvalidArgument, "Volume Capabilities cannot be empty")
} }
for _, cap := range req.VolumeCapabilities {
if cap.GetBlock() != nil {
return nil, status.Error(codes.Unimplemented, "Block Volume not supported")
}
}
volumeNameMutex.LockKey(req.GetName()) volumeNameMutex.LockKey(req.GetName())
defer volumeNameMutex.UnlockKey(req.GetName()) defer volumeNameMutex.UnlockKey(req.GetName())