Commit 65fa5aff authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Jim Harris
Browse files

bdevperf: send RPC error resp. if no jobs started



When bdevperf receives 'perform_tests' RPC call, it prints 'Running
I/O for x seconds' message on the console and is trying to start I/O
jobs. The issue here is that the message is printed even if there are
no jobs defined (e.g. no bdevs created) so nothing really happens. In
such case no RPC response was sent, and the RPC call initiating tests
just timeouts.
This is fixed now and bdevperf will print on the console 'Running
I/O for x seconds' message only if there are any jobs started.
If no jobs are defined, the message is not printed, and RPC error
response is generated:
Error code: SPDK_JSONRPC_ERROR_INVALID_PARAMS (-32602)
Error message: "No jobs defined or bdevs created"

Change-Id: Ibac7a961cd79713ff2bb56a2b5d56c80fb6cc98f
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23902


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
parent 3a141b72
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1603,6 +1603,15 @@ bdevperf_test(void)
{
	struct bdevperf_job *job;

	if (TAILQ_EMPTY(&g_bdevperf.jobs)) {
		if (g_request) {
			spdk_jsonrpc_send_error_response_fmt(g_request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
							     "No jobs defined or bdevs created");
			g_request = NULL;
		}
		return;
	}

	printf("Running I/O for %" PRIu64 " seconds...\n", g_time_in_usec / (uint64_t)SPDK_SEC_TO_USEC);
	fflush(stdout);