rbd: refuse to create block volumes

Without this check, the driver fails one of the E2E storage tests in
Kubernetes 1.13: provisioning a block volume is expected to fail in
e689d515f7/test/e2e/storage/testsuites/volumemode.go (L329-L330)
This commit is contained in:
Patrick Ohly 2018-12-05 14:52:10 +01:00 committed by Huamin Chen
parent c0e775a49b
commit 51d6ac6f55

View File

@ -54,6 +54,11 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
if req.VolumeCapabilities == nil {
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())
defer volumeNameMutex.UnlockKey(req.GetName())