subsystem/nvmf: move adding discovery subsystem out of conf.c
This is a step to prepare for deletion of conf.c. Adding discovery subsystem is now moved out of parsing the legacy config. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: Idd36b5443541a1cc542d6837f17798bc6aaf17e9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4664 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
c3dd7e10a7
commit
356edd8e51
@ -43,23 +43,6 @@
|
|||||||
|
|
||||||
#define SPDK_NVMF_MAX_NAMESPACES (1 << 14)
|
#define SPDK_NVMF_MAX_NAMESPACES (1 << 14)
|
||||||
|
|
||||||
static int
|
|
||||||
nvmf_add_discovery_subsystem(void)
|
|
||||||
{
|
|
||||||
struct spdk_nvmf_subsystem *subsystem;
|
|
||||||
|
|
||||||
subsystem = spdk_nvmf_subsystem_create(g_spdk_nvmf_tgt, SPDK_NVMF_DISCOVERY_NQN,
|
|
||||||
SPDK_NVMF_SUBTYPE_DISCOVERY, 0);
|
|
||||||
if (subsystem == NULL) {
|
|
||||||
SPDK_ERRLOG("Failed creating discovery nvmf library subsystem\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
spdk_nvmf_subsystem_set_allow_any_host(subsystem, true);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvmf_read_config_file_tgt_max_subsystems(struct spdk_conf_section *sp,
|
nvmf_read_config_file_tgt_max_subsystems(struct spdk_conf_section *sp,
|
||||||
int *deprecated_values)
|
int *deprecated_values)
|
||||||
@ -157,7 +140,6 @@ nvmf_parse_tgt_conf(void)
|
|||||||
static int
|
static int
|
||||||
nvmf_parse_nvmf_tgt(void)
|
nvmf_parse_nvmf_tgt(void)
|
||||||
{
|
{
|
||||||
int rc;
|
|
||||||
int using_deprecated_options;
|
int using_deprecated_options;
|
||||||
|
|
||||||
if (!g_spdk_nvmf_tgt_max_subsystems) {
|
if (!g_spdk_nvmf_tgt_max_subsystems) {
|
||||||
@ -179,12 +161,6 @@ nvmf_parse_nvmf_tgt(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = nvmf_add_discovery_subsystem();
|
|
||||||
if (rc != 0) {
|
|
||||||
SPDK_ERRLOG("nvmf_add_discovery_subsystem failed\n");
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +262,23 @@ nvmf_tgt_parse_conf_done(int status)
|
|||||||
nvmf_tgt_advance_state();
|
nvmf_tgt_advance_state();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
nvmf_add_discovery_subsystem(void)
|
||||||
|
{
|
||||||
|
struct spdk_nvmf_subsystem *subsystem;
|
||||||
|
|
||||||
|
subsystem = spdk_nvmf_subsystem_create(g_spdk_nvmf_tgt, SPDK_NVMF_DISCOVERY_NQN,
|
||||||
|
SPDK_NVMF_SUBTYPE_DISCOVERY, 0);
|
||||||
|
if (subsystem == NULL) {
|
||||||
|
SPDK_ERRLOG("Failed creating discovery nvmf library subsystem\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
spdk_nvmf_subsystem_set_allow_any_host(subsystem, true);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvmf_tgt_parse_conf_start(void *ctx)
|
nvmf_tgt_parse_conf_start(void *ctx)
|
||||||
{
|
{
|
||||||
@ -282,6 +299,11 @@ nvmf_tgt_parse_conf_start(void *ctx)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nvmf_add_discovery_subsystem() != 0) {
|
||||||
|
SPDK_ERRLOG("nvmf_add_discovery_subsystem failed\n");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
Loading…
Reference in New Issue
Block a user