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
parent 27fa8a28b8
commit 0f9c9061ce

View File

@ -54,6 +54,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())