nvmf: set serial number after creating subsystem
Remove the serial number from the parameters of spdk_nvmf_construct_subsystem(). Change-Id: Ib6d394cc98fddf85fc878fe0a8c8aa0fdcddf7f4 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/403378 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
12e840b937
commit
1d48012929
@ -178,14 +178,23 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
|
||||
}
|
||||
|
||||
sn = spdk_conf_section_get_val(sp, "SN");
|
||||
if (sn == NULL) {
|
||||
SPDK_ERRLOG("Subsystem %s: missing serial number\n", nqn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
subsystem = spdk_nvmf_construct_subsystem(nqn,
|
||||
sn);
|
||||
|
||||
subsystem = spdk_nvmf_construct_subsystem(nqn);
|
||||
if (subsystem == NULL) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (spdk_nvmf_subsystem_set_sn(subsystem, sn)) {
|
||||
SPDK_ERRLOG("Subsystem %s: invalid serial number '%s'\n", nqn, sn);
|
||||
spdk_nvmf_subsystem_destroy(subsystem);
|
||||
subsystem = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; ; i++) {
|
||||
struct spdk_nvmf_ns_opts ns_opts;
|
||||
struct spdk_bdev *bdev;
|
||||
@ -347,8 +356,7 @@ spdk_nvmf_parse_conf(void)
|
||||
}
|
||||
|
||||
struct spdk_nvmf_subsystem *
|
||||
spdk_nvmf_construct_subsystem(const char *name,
|
||||
const char *sn)
|
||||
spdk_nvmf_construct_subsystem(const char *name)
|
||||
{
|
||||
struct spdk_nvmf_subsystem *subsystem;
|
||||
|
||||
@ -363,19 +371,5 @@ struct spdk_nvmf_subsystem *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (sn == NULL) {
|
||||
SPDK_ERRLOG("Subsystem %s: missing serial number\n", name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (spdk_nvmf_subsystem_set_sn(subsystem, sn)) {
|
||||
SPDK_ERRLOG("Subsystem %s: invalid serial number '%s'\n", name, sn);
|
||||
goto error;
|
||||
}
|
||||
|
||||
return subsystem;
|
||||
|
||||
error:
|
||||
spdk_nvmf_subsystem_destroy(subsystem);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -77,7 +77,6 @@ int spdk_nvmf_parse_conf(void);
|
||||
struct spdk_nvmf_subsystem *nvmf_tgt_create_subsystem(const char *name,
|
||||
enum spdk_nvmf_subtype subtype, uint32_t num_ns);
|
||||
|
||||
struct spdk_nvmf_subsystem *spdk_nvmf_construct_subsystem(const char *name,
|
||||
const char *sn);
|
||||
struct spdk_nvmf_subsystem *spdk_nvmf_construct_subsystem(const char *name);
|
||||
|
||||
#endif
|
||||
|
@ -605,12 +605,16 @@ spdk_rpc_construct_nvmf_subsystem(struct spdk_jsonrpc_request *request,
|
||||
SPDK_NOTICELOG("Ignoring it and continuing.\n");
|
||||
}
|
||||
|
||||
subsystem = spdk_nvmf_construct_subsystem(req.nqn,
|
||||
req.serial_number);
|
||||
subsystem = spdk_nvmf_construct_subsystem(req.nqn);
|
||||
if (!subsystem) {
|
||||
goto invalid;
|
||||
}
|
||||
|
||||
if (spdk_nvmf_subsystem_set_sn(subsystem, req.serial_number)) {
|
||||
SPDK_ERRLOG("Subsystem %s: invalid serial number '%s'\n", req.nqn, req.serial_number);
|
||||
goto invalid;
|
||||
}
|
||||
|
||||
for (i = 0; i < req.hosts.num_hosts; i++) {
|
||||
spdk_nvmf_subsystem_add_host(subsystem, req.hosts.hosts[i]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user