mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +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.
|
// Default supports all capabilities.
|
||||||
func (cs *DefaultControllerServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
|
func (cs *DefaultControllerServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error) {
|
||||||
util.TraceLog(ctx, "Using default ControllerGetCapabilities")
|
util.TraceLog(ctx, "Using default ControllerGetCapabilities")
|
||||||
|
if cs.Driver == nil {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "Controller server is not enabled")
|
||||||
|
}
|
||||||
return &csi.ControllerGetCapabilitiesResponse{
|
return &csi.ControllerGetCapabilitiesResponse{
|
||||||
Capabilities: cs.Driver.capabilities,
|
Capabilities: cs.Driver.capabilities,
|
||||||
}, nil
|
}, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user