nvmf: emit add_listeners RPCs after add_ns RPCs

When emitting the JSON-RPC text for saving the
current configuration, add the listeners last.

This is usually the preferred order when
configuring a new subsystem - it is better to have
all of the namespaces and hosts added to the subsystem
before adding the listener to allow hosts to connect
to it.  We support namespace hotplug but there's
no need to unnecessarily generate hotplug events
if we can avoid it.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I79e8a0a496eeb128efbb7e314ac835b6110d3cc8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14586
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2022-09-21 00:22:32 +00:00 committed by Tomasz Zawadzki
parent dc43aae54d
commit 9633d482a7

View File

@ -479,26 +479,6 @@ nvmf_write_subsystem_config_json(struct spdk_json_write_ctx *w,
/* } */ /* } */
spdk_json_write_object_end(w); spdk_json_write_object_end(w);
for (listener = spdk_nvmf_subsystem_get_first_listener(subsystem); listener != NULL;
listener = spdk_nvmf_subsystem_get_next_listener(subsystem, listener)) {
trid = spdk_nvmf_subsystem_listener_get_trid(listener);
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "nvmf_subsystem_add_listener");
/* "params" : { */
spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_string(w, "nqn", spdk_nvmf_subsystem_get_nqn(subsystem));
nvmf_transport_listen_dump_opts(listener->transport, trid, w);
/* } "params" */
spdk_json_write_object_end(w);
/* } */
spdk_json_write_object_end(w);
}
for (host = spdk_nvmf_subsystem_get_first_host(subsystem); host != NULL; for (host = spdk_nvmf_subsystem_get_first_host(subsystem); host != NULL;
host = spdk_nvmf_subsystem_get_next_host(subsystem, host)) { host = spdk_nvmf_subsystem_get_next_host(subsystem, host)) {
@ -565,6 +545,27 @@ nvmf_write_subsystem_config_json(struct spdk_json_write_ctx *w,
/* } */ /* } */
spdk_json_write_object_end(w); spdk_json_write_object_end(w);
} }
for (listener = spdk_nvmf_subsystem_get_first_listener(subsystem); listener != NULL;
listener = spdk_nvmf_subsystem_get_next_listener(subsystem, listener)) {
trid = spdk_nvmf_subsystem_listener_get_trid(listener);
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "nvmf_subsystem_add_listener");
/* "params" : { */
spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_string(w, "nqn", spdk_nvmf_subsystem_get_nqn(subsystem));
nvmf_transport_listen_dump_opts(listener->transport, trid, w);
/* } "params" */
spdk_json_write_object_end(w);
/* } */
spdk_json_write_object_end(w);
}
} }
void void