mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
util: add nil check to default ControllerGetCapabilities()
Currently default ControllerGetCapabilities function is being used which throws 'runtime error: invalid memory address or nil pointer dereference' when `--controllerServer=true` is not set in provisioner deployment args. This commit adds a check to prevent it. Fixes: 1925 Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
10d539efc8
commit
ae6a52a84e
@ -60,7 +60,9 @@ func (cs *DefaultControllerServer) GetCapacity(ctx context.Context, req *csi.Get
|
||||
// Default supports all capabilities.
|
||||
func (cs *DefaultControllerServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
|
||||
util.TraceLog(ctx, "Using default ControllerGetCapabilities")
|
||||
|
||||
if cs.Driver == nil {
|
||||
return nil, status.Error(codes.Unimplemented, "Controller server is not enabled")
|
||||
}
|
||||
return &csi.ControllerGetCapabilitiesResponse{
|
||||
Capabilities: cs.Driver.capabilities,
|
||||
}, nil
|
||||
|
Loading…
Reference in New Issue
Block a user