nvmf: centralize duplicate subsystem NQN check

This should be enforced by the main NVMe-oF target library, not in the
event subsystem code.

Change-Id: Ibce4fd78710b4a9da374e3d5979df4a16e91533c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/403380
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Daniel Verkamp 2018-03-09 17:13:35 -07:00
parent 3f987aa84d
commit 524e8fc976
4 changed files with 17 additions and 5 deletions

View File

@ -88,11 +88,6 @@ nvmf_tgt_create_subsystem(const char *name, enum spdk_nvmf_subtype subtype, uint
{
struct spdk_nvmf_subsystem *subsystem;
if (spdk_nvmf_tgt_find_subsystem(g_tgt.tgt, name)) {
SPDK_ERRLOG("Subsystem already exist\n");
return NULL;
}
subsystem = spdk_nvmf_subsystem_create(g_tgt.tgt, name, subtype, num_ns);
if (subsystem == NULL) {
SPDK_ERRLOG("Subsystem creation failed\n");

View File

@ -222,6 +222,11 @@ spdk_nvmf_subsystem_create(struct spdk_nvmf_tgt *tgt,
struct spdk_nvmf_subsystem *subsystem;
uint32_t sid;
if (spdk_nvmf_tgt_find_subsystem(tgt, nqn)) {
SPDK_ERRLOG("Subsystem NQN '%s' already exists\n", nqn);
return NULL;
}
if (!spdk_nvmf_valid_nqn(nqn)) {
return NULL;
}

View File

@ -105,6 +105,12 @@ spdk_nvmf_transport_create(struct spdk_nvmf_tgt *tgt,
return NULL;
}
struct spdk_nvmf_subsystem *
spdk_nvmf_tgt_find_subsystem(struct spdk_nvmf_tgt *tgt, const char *subnqn)
{
return NULL;
}
struct spdk_nvmf_transport *
spdk_nvmf_tgt_get_transport(struct spdk_nvmf_tgt *tgt, enum spdk_nvme_transport_type trtype)
{

View File

@ -92,6 +92,12 @@ spdk_nvmf_transport_create(struct spdk_nvmf_tgt *tgt,
return NULL;
}
struct spdk_nvmf_subsystem *
spdk_nvmf_tgt_find_subsystem(struct spdk_nvmf_tgt *tgt, const char *subnqn)
{
return NULL;
}
struct spdk_nvmf_transport *
spdk_nvmf_tgt_get_transport(struct spdk_nvmf_tgt *tgt, enum spdk_nvme_transport_type trtype)
{