nvmf: Remove NodeBase. Each Subsystem now defines its own NQN

This is just extra complication for no real benefit.

Change-Id: I528af98e799d0641e753390fe35ff561fa3d7d76
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-07-11 15:22:03 -07:00
parent 175b12e813
commit b531f5914e
6 changed files with 16 additions and 59 deletions

View File

@ -28,10 +28,6 @@
# This next section defines NVMf protocol specific global options
[Nvmf]
# node name (not include optional part)
# Users can optionally change this to fit their environment.
NodeBase "nqn.2016-06.io.spdk"
# Set the maximum number of NVMf logical controller sessions allowed
# for each subsystem provisioned below. The default value (1) is used if
# not set here.
@ -94,22 +90,19 @@
# session within the NVMf subsystem. Any such session is allowed access
# to all NVMe namespaces within the subsystem.
#
# SubsystemName, Mapping, Controller are minimum required
# The SubsystemName is concatenated with NodeBase above to form the NVMf
# subsystem NQN that will be used by remote initiator to identify the
# target subsystem for connection.
# NQN, Mapping, Controller are minimum required.
# The Mapping defines the local fabric network port to be used by remote
# connecting initiator. Multiple mappings can be used to permit shared
# access to the same subsystem.
# Each Controller identifies a specific HW device from the Nvme whitelist
# section above.
[Subsystem1]
SubsystemName cnode1
NQN nqn.2016-06.io.spdk:cnode1
Mapping Port1 Host1
Controller Nvme0
[Subsystem2]
SubsystemName cnode2
NQN nqn.2016-06.io.spdk:cnode2
Mapping Port2 Host2
# Using NVME 1 namespace 1
Controller Nvme1

View File

@ -47,7 +47,6 @@ static int
spdk_nvmf_parse_nvmf_tgt(void)
{
struct spdk_conf_section *sp;
char *nodebase;
int max_queue_depth;
int max_conn_per_sess;
int rc;
@ -58,11 +57,6 @@ spdk_nvmf_parse_nvmf_tgt(void)
return -1;
}
nodebase = spdk_conf_section_get_val(sp, "NodeBase");
if (nodebase == NULL) {
nodebase = SPDK_NVMF_DEFAULT_NODEBASE;
}
max_queue_depth = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
if (max_queue_depth < 0) {
max_queue_depth = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
@ -73,8 +67,7 @@ spdk_nvmf_parse_nvmf_tgt(void)
max_conn_per_sess = SPDK_NVMF_DEFAULT_MAX_CONNECTIONS_PER_SESSION;
}
rc = nvmf_tgt_init(nodebase, max_queue_depth, max_conn_per_sess);
rc = nvmf_tgt_init(max_queue_depth, max_conn_per_sess);
return rc;
}

View File

@ -108,18 +108,10 @@ spdk_nvmf_check_pools(void)
}
int
nvmf_tgt_init(char *nodebase,
int max_queue_depth, int max_conn_per_sess)
nvmf_tgt_init(int max_queue_depth, int max_conn_per_sess)
{
int rc;
g_nvmf_tgt.nodebase = strdup(nodebase);
if (!g_nvmf_tgt.nodebase) {
SPDK_ERRLOG("No NodeBase provided\n");
return -EINVAL;
}
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "NodeBase: %s\n", g_nvmf_tgt.nodebase);
if (max_queue_depth >= 1 &&
max_queue_depth <= SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH) {
g_nvmf_tgt.MaxQueueDepth = max_queue_depth;
@ -202,7 +194,6 @@ nvmf_tgt_subsystem_fini(void)
spdk_nvmf_host_destroy_all();
spdk_nvmf_port_destroy_all();
spdk_nvmf_rdma_fini();
free(g_nvmf_tgt.nodebase);
pthread_mutex_destroy(&g_nvmf_tgt.mutex);

View File

@ -55,7 +55,6 @@
#define SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE DEFAULT_BB_SIZE
#define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
#define SPDK_NVMF_DEFAULT_NODEBASE "nqn.2016-06.io.spdk"
#define SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH 128
#define SPDK_NVMF_DEFAULT_MAX_CONNECTIONS_PER_SESSION 4
#define SPDK_NVMF_DEFAULT_SIN_PORT ((uint16_t)4420)
@ -98,8 +97,6 @@ struct __attribute__((packed)) nvme_read_cdw13 {
};
struct spdk_nvmf_globals {
char *nodebase;
pthread_mutex_t mutex;
int MaxQueueDepth;
@ -108,7 +105,7 @@ struct spdk_nvmf_globals {
uint16_t sin_port;
};
int nvmf_tgt_init(char *nodebase, int max_queue_depth, int max_conn_per_sess);
int nvmf_tgt_init(int max_queue_depth, int max_conn_per_sess);
extern struct spdk_nvmf_globals g_nvmf_tgt;

View File

@ -216,7 +216,7 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp)
struct spdk_nvmf_subsystem_grp *ss_group;
const char *port_tag, *ig_tag;
const char *val;
char *name = NULL;
char *nqn;
int port_tag_i, ig_tag_i;
struct spdk_nvmf_ctrlr *nvmf_ctrlr;
int i, ret;
@ -232,30 +232,19 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp)
ss_group->num = sp->num;
/* read in and verify the NQN for the subsystem */
val = spdk_conf_section_get_val(sp, "SubsystemName");
if (val == NULL) {
SPDK_ERRLOG("Subsystem Group %d: SubsystemName not found\n", ss_group->num);
nqn = spdk_conf_section_get_val(sp, "NQN");
if (nqn == NULL) {
SPDK_ERRLOG("Subsystem Group %d: NQN not found\n", ss_group->num);
goto err0;
}
if (strncasecmp(val, "nqn.", 4) != 0) {
name = spdk_sprintf_alloc("%s:%s", g_nvmf_tgt.nodebase, val);
} else {
name = strdup(val);
}
if (!name) {
SPDK_ERRLOG("Could not allocate Controller Node name\n");
if (spdk_check_nvmf_name(nqn) != 0) {
SPDK_ERRLOG("Controller Node name (n=%s) contains an invalid character or format.\n",
nqn);
goto err0;
}
if (spdk_check_nvmf_name(name) != 0) {
SPDK_ERRLOG("Controller Node name (n=%s) (fn=%s) contains an invalid character or format.\n",
name, name);
goto err0;
}
printf(" NVMf Subsystem: Name: %s\n", name);
printf(" NVMf Subsystem: Name: %s\n", nqn);
/* Setup initiator and port access mapping */
val = spdk_conf_section_get_val(sp, "Mapping");
@ -301,7 +290,7 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp)
}
/* register this subsystem with the NVMf library */
ss_group->subsystem = nvmf_create_subsystem(ss_group->num, name, SPDK_NVMF_SUB_NVME);
ss_group->subsystem = nvmf_create_subsystem(ss_group->num, nqn, SPDK_NVMF_SUB_NVME);
if (ss_group->subsystem == NULL) {
SPDK_ERRLOG("Failed creating new nvmf library subsystem\n");
goto err0;
@ -331,13 +320,8 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp)
TAILQ_INSERT_TAIL(&g_ssg_head, ss_group, tailq);
free(name);
return 0;
err0:
if (name) {
free(name);
}
spdk_nvmf_subsystem_destruct(ss_group);
return -1;
}

View File

@ -3,7 +3,6 @@
LogFacility "local7"
[Nvmf]
NodeBase "nqn.2016-06.io.spdk"
MaxConnectionsPerSession 4
[Port1]
@ -18,7 +17,7 @@
UnbindFromKernel Yes
[Subsystem1]
SubsystemName cnode1
NQN "nqn.2016-06.io.spdk:cnode1"
Mapping Port1 Host1
QueueDepth 128
Controller Nvme0