Fix Cephfs plugin to return false to ValidateVolumeCapabilities if Block volume is specified

Cephfs doesn't have a feature to provide Block Volume, therefore it should return false to ValidateVolumeCapabilities if Block Volume is specified.

Fixes #44
This commit is contained in:
Masaki Kimura 2018-07-10 16:48:55 +00:00
parent 0df9e8e794
commit 753dbc2303

View File

@ -185,5 +185,11 @@ func (cs *controllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVol
func (cs *controllerServer) ValidateVolumeCapabilities( func (cs *controllerServer) ValidateVolumeCapabilities(
ctx context.Context, ctx context.Context,
req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) { req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error) {
// Cephfs doesn't support Block volume
for _, cap := range req.VolumeCapabilities {
if cap.GetBlock() != nil {
return &csi.ValidateVolumeCapabilitiesResponse{Supported: false, Message: ""}, nil
}
}
return &csi.ValidateVolumeCapabilitiesResponse{Supported: true}, nil return &csi.ValidateVolumeCapabilitiesResponse{Supported: true}, nil
} }