rpc: return RPC internal error when unable to get log level string

Change-Id: I403172e07946911c29e511c5954d862d6971bf0b
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/433834
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2018-11-19 05:42:26 -05:00 committed by Jim Harris
parent c06daf9ad3
commit f6109e23f6

View File

@ -151,16 +151,21 @@ spdk_rpc_get_log_print_level(struct spdk_jsonrpc_request *request,
return;
}
level = spdk_log_get_print_level();
name = _get_log_level_name(level);
if (name == NULL) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Internal error");
return;
}
w = spdk_jsonrpc_begin_result(request);
if (w == NULL) {
return;
}
level = spdk_log_get_print_level();
name = _get_log_level_name(level);
spdk_json_write_string(w, name);
spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("get_log_print_level", spdk_rpc_get_log_print_level,
@ -219,13 +224,19 @@ spdk_rpc_get_log_level(struct spdk_jsonrpc_request *request,
return;
}
level = spdk_log_get_level();
name = _get_log_level_name(level);
if (name == NULL) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Internal error");
return;
}
w = spdk_jsonrpc_begin_result(request);
if (w == NULL) {
return;
}
level = spdk_log_get_level();
name = _get_log_level_name(level);
spdk_json_write_string(w, name);
spdk_jsonrpc_end_result(request, w);