bdev/nvme: allow the nvme opts set when no nvme bdev configured

In the case that there is no NVMe bdev configured and RPC is
running, it shall still allow the NVMe options set. Once there
is one NVMe bdev configured, it will not allow the NVMe options
set.

Change-Id: Ib6a527174137a5d4df7babe206d2527e600500c0
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/479489
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
GangCao 2020-01-07 13:53:13 -05:00 committed by Tomasz Zawadzki
parent d31eb732af
commit 70db9e5cb9
3 changed files with 6 additions and 3 deletions

View File

@ -1445,7 +1445,7 @@ Example response:
## bdev_nvme_set_options {#rpc_bdev_nvme_set_options}
Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized.
Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized or any bdev NVMe has been created.
### Parameters

View File

@ -1351,7 +1351,9 @@ int
spdk_bdev_nvme_set_opts(const struct spdk_bdev_nvme_opts *opts)
{
if (g_bdev_nvme_init_thread != NULL) {
return -EPERM;
if (!TAILQ_EMPTY(&g_nvme_bdev_ctrlrs)) {
return -EPERM;
}
}
g_opts = *opts;

View File

@ -115,7 +115,8 @@ spdk_rpc_bdev_nvme_set_options(struct spdk_jsonrpc_request *request,
return;
}
SPDK_RPC_REGISTER("bdev_nvme_set_options", spdk_rpc_bdev_nvme_set_options, SPDK_RPC_STARTUP)
SPDK_RPC_REGISTER("bdev_nvme_set_options", spdk_rpc_bdev_nvme_set_options,
SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(bdev_nvme_set_options, set_bdev_nvme_options)
struct rpc_bdev_nvme_hotplug {