Commit c8e594c2 authored by gongwei's avatar gongwei Committed by Tomasz Zawadzki
Browse files

bdev_iscsi: modify the timeout parameter name of iscsi opts



the current timeout parameter of the interface bdev_iscsi_set_opts is
duplicated with the timeout parameter of the JSONRPCClient parameter,
which may cause the iscsi timeout and JSONRPCClient parameters to
overwrite each other.

Signed-off-by: default avatargongwei <gongwei833x@gmail.com>
Change-Id: I96604a7e1a495ac2e99518812297230680df42fd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14306


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent 59c10a2f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4616,7 +4616,7 @@ This RPC can be called at any time, but the new value will only take effect for

Name                       | Optional | Type        | Description
-------------------------- | -------- | ----------- | -----------
timeout                    | Optional | number      | Timeout for command, in seconds, if 0, don't track timeout
timeout_sec                | Optional | number      | Timeout for command, in seconds, if 0, don't track timeout

#### Example

@@ -4626,7 +4626,7 @@ Example request:
request:
{
  "params": {
    "timeout": 30
    "timeout_sec": 30
  },
  "jsonrpc": "2.0",
  "method": "bdev_iscsi_set_options",
+4 −4
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ struct bdev_iscsi_conn_req {
};

static struct spdk_bdev_iscsi_opts g_opts = {
	.timeout = BDEV_ISCSI_TIMEOUT_DEFAULT,
	.timeout_sec = BDEV_ISCSI_TIMEOUT_DEFAULT,
	.timeout_poller_period_us = BDEV_ISCSI_TIMEOUT_POLL_PERIOD_DEFAULT,
};

@@ -115,7 +115,7 @@ int
bdev_iscsi_set_opts(struct spdk_bdev_iscsi_opts *opts)
{
	/* make the poller period equal to timeout / 30 */
	opts->timeout_poller_period_us = (opts->timeout * 1000000ULL) /
	opts->timeout_poller_period_us = (opts->timeout_sec * 1000000ULL) /
					 BDEV_ISCSI_TIMEOUT_POLL_PERIOD_DIVISOR;

	g_opts = *opts;
@@ -661,7 +661,7 @@ bdev_iscsi_create_cb(void *io_device, void *ctx_buf)
		assert(lun->main_td == NULL);
		lun->main_td = spdk_get_thread();
		lun->poller = SPDK_POLLER_REGISTER(bdev_iscsi_poll_lun, lun, 0);
		if (g_opts.timeout > 0) {
		if (g_opts.timeout_sec > 0) {
			lun->timeout_poller = SPDK_POLLER_REGISTER(bdev_iscsi_poll_lun_timeout, lun,
					      g_opts.timeout_poller_period_us);
		}
@@ -1044,7 +1044,7 @@ create_iscsi_disk(const char *bdev_name, const char *url, const char *initiator_
	rc = iscsi_set_session_type(req->context, ISCSI_SESSION_NORMAL);
	rc = rc ? rc : iscsi_set_header_digest(req->context, ISCSI_HEADER_DIGEST_NONE);
	rc = rc ? rc : iscsi_set_targetname(req->context, iscsi_url->target);
	rc = rc ? rc : iscsi_set_timeout(req->context, g_opts.timeout);
	rc = rc ? rc : iscsi_set_timeout(req->context, g_opts.timeout_sec);
	rc = rc ? rc : iscsi_full_connect_async(req->context, iscsi_url->portal, iscsi_url->lun,
						iscsi_connect_cb, req);
	if (rc == 0 && iscsi_url->user[0] != '\0') {
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
#include "spdk/bdev.h"

struct spdk_bdev_iscsi_opts {
	uint64_t timeout;
	uint64_t timeout_sec;
	uint64_t timeout_poller_period_us;
};

+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
#include "spdk/log.h"

static const struct spdk_json_object_decoder rpc_bdev_iscsi_options_decoders[] = {
	{"timeout", offsetof(struct spdk_bdev_iscsi_opts, timeout), spdk_json_decode_uint64, true},
	{"timeout_sec", offsetof(struct spdk_bdev_iscsi_opts, timeout_sec), spdk_json_decode_uint64, true},
};

static void
+4 −4
Original line number Diff line number Diff line
@@ -1116,16 +1116,16 @@ def bdev_error_delete(client, name):
    return client.call('bdev_error_delete', params)


def bdev_iscsi_set_options(client, timeout):
def bdev_iscsi_set_options(client, timeout_sec):
    """Set options for the bdev iscsi.

    Args:
        timeout: Timeout for command, in seconds, if 0, don't track timeout
        timeout_sec: Timeout for command, in seconds, if 0, don't track timeout
    """
    params = {}

    if timeout is not None:
        params['timeout'] = timeout
    if timeout_sec is not None:
        params['timeout_sec'] = timeout_sec

    return client.call('bdev_iscsi_set_options', params)

Loading