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: gongwei <gongwei833x@gmail.com> Change-Id: I96604a7e1a495ac2e99518812297230680df42fd Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14306 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
parent
59c10a2fa2
commit
c8e594c2a0
@ -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
|
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
|
#### Example
|
||||||
|
|
||||||
@ -4626,7 +4626,7 @@ Example request:
|
|||||||
request:
|
request:
|
||||||
{
|
{
|
||||||
"params": {
|
"params": {
|
||||||
"timeout": 30
|
"timeout_sec": 30
|
||||||
},
|
},
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"method": "bdev_iscsi_set_options",
|
"method": "bdev_iscsi_set_options",
|
||||||
|
@ -101,7 +101,7 @@ struct bdev_iscsi_conn_req {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct spdk_bdev_iscsi_opts g_opts = {
|
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,
|
.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)
|
bdev_iscsi_set_opts(struct spdk_bdev_iscsi_opts *opts)
|
||||||
{
|
{
|
||||||
/* make the poller period equal to timeout / 30 */
|
/* 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;
|
BDEV_ISCSI_TIMEOUT_POLL_PERIOD_DIVISOR;
|
||||||
|
|
||||||
g_opts = *opts;
|
g_opts = *opts;
|
||||||
@ -661,7 +661,7 @@ bdev_iscsi_create_cb(void *io_device, void *ctx_buf)
|
|||||||
assert(lun->main_td == NULL);
|
assert(lun->main_td == NULL);
|
||||||
lun->main_td = spdk_get_thread();
|
lun->main_td = spdk_get_thread();
|
||||||
lun->poller = SPDK_POLLER_REGISTER(bdev_iscsi_poll_lun, lun, 0);
|
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,
|
lun->timeout_poller = SPDK_POLLER_REGISTER(bdev_iscsi_poll_lun_timeout, lun,
|
||||||
g_opts.timeout_poller_period_us);
|
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 = 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_header_digest(req->context, ISCSI_HEADER_DIGEST_NONE);
|
||||||
rc = rc ? rc : iscsi_set_targetname(req->context, iscsi_url->target);
|
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,
|
rc = rc ? rc : iscsi_full_connect_async(req->context, iscsi_url->portal, iscsi_url->lun,
|
||||||
iscsi_connect_cb, req);
|
iscsi_connect_cb, req);
|
||||||
if (rc == 0 && iscsi_url->user[0] != '\0') {
|
if (rc == 0 && iscsi_url->user[0] != '\0') {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "spdk/bdev.h"
|
#include "spdk/bdev.h"
|
||||||
|
|
||||||
struct spdk_bdev_iscsi_opts {
|
struct spdk_bdev_iscsi_opts {
|
||||||
uint64_t timeout;
|
uint64_t timeout_sec;
|
||||||
uint64_t timeout_poller_period_us;
|
uint64_t timeout_poller_period_us;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
|
|
||||||
static const struct spdk_json_object_decoder rpc_bdev_iscsi_options_decoders[] = {
|
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
|
static void
|
||||||
|
@ -1116,16 +1116,16 @@ def bdev_error_delete(client, name):
|
|||||||
return client.call('bdev_error_delete', params)
|
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.
|
"""Set options for the bdev iscsi.
|
||||||
|
|
||||||
Args:
|
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 = {}
|
params = {}
|
||||||
|
|
||||||
if timeout is not None:
|
if timeout_sec is not None:
|
||||||
params['timeout'] = timeout
|
params['timeout_sec'] = timeout_sec
|
||||||
|
|
||||||
return client.call('bdev_iscsi_set_options', params)
|
return client.call('bdev_iscsi_set_options', params)
|
||||||
|
|
||||||
|
@ -998,10 +998,10 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
def bdev_iscsi_set_options(args):
|
def bdev_iscsi_set_options(args):
|
||||||
rpc.bdev.bdev_iscsi_set_options(args.client,
|
rpc.bdev.bdev_iscsi_set_options(args.client,
|
||||||
timeout=args.timeout)
|
timeout_sec=args.timeout_sec)
|
||||||
|
|
||||||
p = subparsers.add_parser('bdev_iscsi_set_options', help='Set options for the bdev iscsi type.')
|
p = subparsers.add_parser('bdev_iscsi_set_options', help='Set options for the bdev iscsi type.')
|
||||||
p.add_argument('-t', '--timeout', help="Timeout for command, in seconds, if 0, don't track timeout.", type=int)
|
p.add_argument('-t', '--timeout-sec', help="Timeout for command, in seconds, if 0, don't track timeout.", type=int)
|
||||||
p.set_defaults(func=bdev_iscsi_set_options)
|
p.set_defaults(func=bdev_iscsi_set_options)
|
||||||
|
|
||||||
def bdev_iscsi_create(args):
|
def bdev_iscsi_create(args):
|
||||||
|
Loading…
Reference in New Issue
Block a user