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:
parent
175b12e813
commit
b531f5914e
@ -28,10 +28,6 @@
|
|||||||
|
|
||||||
# This next section defines NVMf protocol specific global options
|
# This next section defines NVMf protocol specific global options
|
||||||
[Nvmf]
|
[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
|
# Set the maximum number of NVMf logical controller sessions allowed
|
||||||
# for each subsystem provisioned below. The default value (1) is used if
|
# for each subsystem provisioned below. The default value (1) is used if
|
||||||
# not set here.
|
# not set here.
|
||||||
@ -94,22 +90,19 @@
|
|||||||
# session within the NVMf subsystem. Any such session is allowed access
|
# session within the NVMf subsystem. Any such session is allowed access
|
||||||
# to all NVMe namespaces within the subsystem.
|
# to all NVMe namespaces within the subsystem.
|
||||||
#
|
#
|
||||||
# SubsystemName, Mapping, Controller are minimum required
|
# NQN, 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.
|
|
||||||
# The Mapping defines the local fabric network port to be used by remote
|
# The Mapping defines the local fabric network port to be used by remote
|
||||||
# connecting initiator. Multiple mappings can be used to permit shared
|
# connecting initiator. Multiple mappings can be used to permit shared
|
||||||
# access to the same subsystem.
|
# access to the same subsystem.
|
||||||
# Each Controller identifies a specific HW device from the Nvme whitelist
|
# Each Controller identifies a specific HW device from the Nvme whitelist
|
||||||
# section above.
|
# section above.
|
||||||
[Subsystem1]
|
[Subsystem1]
|
||||||
SubsystemName cnode1
|
NQN nqn.2016-06.io.spdk:cnode1
|
||||||
Mapping Port1 Host1
|
Mapping Port1 Host1
|
||||||
Controller Nvme0
|
Controller Nvme0
|
||||||
|
|
||||||
[Subsystem2]
|
[Subsystem2]
|
||||||
SubsystemName cnode2
|
NQN nqn.2016-06.io.spdk:cnode2
|
||||||
Mapping Port2 Host2
|
Mapping Port2 Host2
|
||||||
# Using NVME 1 namespace 1
|
# Using NVME 1 namespace 1
|
||||||
Controller Nvme1
|
Controller Nvme1
|
||||||
|
@ -47,7 +47,6 @@ static int
|
|||||||
spdk_nvmf_parse_nvmf_tgt(void)
|
spdk_nvmf_parse_nvmf_tgt(void)
|
||||||
{
|
{
|
||||||
struct spdk_conf_section *sp;
|
struct spdk_conf_section *sp;
|
||||||
char *nodebase;
|
|
||||||
int max_queue_depth;
|
int max_queue_depth;
|
||||||
int max_conn_per_sess;
|
int max_conn_per_sess;
|
||||||
int rc;
|
int rc;
|
||||||
@ -58,11 +57,6 @@ spdk_nvmf_parse_nvmf_tgt(void)
|
|||||||
return -1;
|
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");
|
max_queue_depth = spdk_conf_section_get_intval(sp, "MaxQueueDepth");
|
||||||
if (max_queue_depth < 0) {
|
if (max_queue_depth < 0) {
|
||||||
max_queue_depth = SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH;
|
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;
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,18 +108,10 @@ spdk_nvmf_check_pools(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nvmf_tgt_init(char *nodebase,
|
nvmf_tgt_init(int max_queue_depth, int max_conn_per_sess)
|
||||||
int max_queue_depth, int max_conn_per_sess)
|
|
||||||
{
|
{
|
||||||
int rc;
|
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 &&
|
if (max_queue_depth >= 1 &&
|
||||||
max_queue_depth <= SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH) {
|
max_queue_depth <= SPDK_NVMF_DEFAULT_MAX_QUEUE_DEPTH) {
|
||||||
g_nvmf_tgt.MaxQueueDepth = 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_host_destroy_all();
|
||||||
spdk_nvmf_port_destroy_all();
|
spdk_nvmf_port_destroy_all();
|
||||||
spdk_nvmf_rdma_fini();
|
spdk_nvmf_rdma_fini();
|
||||||
free(g_nvmf_tgt.nodebase);
|
|
||||||
|
|
||||||
pthread_mutex_destroy(&g_nvmf_tgt.mutex);
|
pthread_mutex_destroy(&g_nvmf_tgt.mutex);
|
||||||
|
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
#define SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE DEFAULT_BB_SIZE
|
#define SPDK_NVMF_MAX_RECV_DATA_TRANSFER_SIZE DEFAULT_BB_SIZE
|
||||||
|
|
||||||
#define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
|
#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_QUEUE_DEPTH 128
|
||||||
#define SPDK_NVMF_DEFAULT_MAX_CONNECTIONS_PER_SESSION 4
|
#define SPDK_NVMF_DEFAULT_MAX_CONNECTIONS_PER_SESSION 4
|
||||||
#define SPDK_NVMF_DEFAULT_SIN_PORT ((uint16_t)4420)
|
#define SPDK_NVMF_DEFAULT_SIN_PORT ((uint16_t)4420)
|
||||||
@ -98,8 +97,6 @@ struct __attribute__((packed)) nvme_read_cdw13 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct spdk_nvmf_globals {
|
struct spdk_nvmf_globals {
|
||||||
char *nodebase;
|
|
||||||
|
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
|
|
||||||
int MaxQueueDepth;
|
int MaxQueueDepth;
|
||||||
@ -108,7 +105,7 @@ struct spdk_nvmf_globals {
|
|||||||
uint16_t sin_port;
|
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;
|
extern struct spdk_nvmf_globals g_nvmf_tgt;
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp)
|
|||||||
struct spdk_nvmf_subsystem_grp *ss_group;
|
struct spdk_nvmf_subsystem_grp *ss_group;
|
||||||
const char *port_tag, *ig_tag;
|
const char *port_tag, *ig_tag;
|
||||||
const char *val;
|
const char *val;
|
||||||
char *name = NULL;
|
char *nqn;
|
||||||
int port_tag_i, ig_tag_i;
|
int port_tag_i, ig_tag_i;
|
||||||
struct spdk_nvmf_ctrlr *nvmf_ctrlr;
|
struct spdk_nvmf_ctrlr *nvmf_ctrlr;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
@ -232,30 +232,19 @@ spdk_cf_add_nvmf_subsystem(struct spdk_conf_section *sp)
|
|||||||
ss_group->num = sp->num;
|
ss_group->num = sp->num;
|
||||||
|
|
||||||
/* read in and verify the NQN for the subsystem */
|
/* read in and verify the NQN for the subsystem */
|
||||||
val = spdk_conf_section_get_val(sp, "SubsystemName");
|
nqn = spdk_conf_section_get_val(sp, "NQN");
|
||||||
if (val == NULL) {
|
if (nqn == NULL) {
|
||||||
SPDK_ERRLOG("Subsystem Group %d: SubsystemName not found\n", ss_group->num);
|
SPDK_ERRLOG("Subsystem Group %d: NQN not found\n", ss_group->num);
|
||||||
goto err0;
|
goto err0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncasecmp(val, "nqn.", 4) != 0) {
|
if (spdk_check_nvmf_name(nqn) != 0) {
|
||||||
name = spdk_sprintf_alloc("%s:%s", g_nvmf_tgt.nodebase, val);
|
SPDK_ERRLOG("Controller Node name (n=%s) contains an invalid character or format.\n",
|
||||||
} else {
|
nqn);
|
||||||
name = strdup(val);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!name) {
|
|
||||||
SPDK_ERRLOG("Could not allocate Controller Node name\n");
|
|
||||||
goto err0;
|
goto err0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spdk_check_nvmf_name(name) != 0) {
|
printf(" NVMf Subsystem: Name: %s\n", nqn);
|
||||||
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);
|
|
||||||
|
|
||||||
/* Setup initiator and port access mapping */
|
/* Setup initiator and port access mapping */
|
||||||
val = spdk_conf_section_get_val(sp, "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 */
|
/* 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) {
|
if (ss_group->subsystem == NULL) {
|
||||||
SPDK_ERRLOG("Failed creating new nvmf library subsystem\n");
|
SPDK_ERRLOG("Failed creating new nvmf library subsystem\n");
|
||||||
goto err0;
|
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);
|
TAILQ_INSERT_TAIL(&g_ssg_head, ss_group, tailq);
|
||||||
|
|
||||||
free(name);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
err0:
|
err0:
|
||||||
if (name) {
|
|
||||||
free(name);
|
|
||||||
}
|
|
||||||
spdk_nvmf_subsystem_destruct(ss_group);
|
spdk_nvmf_subsystem_destruct(ss_group);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
LogFacility "local7"
|
LogFacility "local7"
|
||||||
|
|
||||||
[Nvmf]
|
[Nvmf]
|
||||||
NodeBase "nqn.2016-06.io.spdk"
|
|
||||||
MaxConnectionsPerSession 4
|
MaxConnectionsPerSession 4
|
||||||
|
|
||||||
[Port1]
|
[Port1]
|
||||||
@ -18,7 +17,7 @@
|
|||||||
UnbindFromKernel Yes
|
UnbindFromKernel Yes
|
||||||
|
|
||||||
[Subsystem1]
|
[Subsystem1]
|
||||||
SubsystemName cnode1
|
NQN "nqn.2016-06.io.spdk:cnode1"
|
||||||
Mapping Port1 Host1
|
Mapping Port1 Host1
|
||||||
QueueDepth 128
|
QueueDepth 128
|
||||||
Controller Nvme0
|
Controller Nvme0
|
||||||
|
Loading…
Reference in New Issue
Block a user