nvmf/rpc: add max_namespaces to get_nvmf_subsystems
This is one of the construct_nvmf_subsystems parameters, so we need a public API to retrieve it for informational purposes and for the JSON-RPC configuration dump. Change-Id: I8a7cafa487209311e964ea9ff1b8e09ee8b23c07 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/414864 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
34de1542eb
commit
6546fd10f8
@ -566,6 +566,15 @@ struct spdk_nvmf_ns *spdk_nvmf_subsystem_get_next_ns(struct spdk_nvmf_subsystem
|
||||
struct spdk_nvmf_ns *spdk_nvmf_subsystem_get_ns(struct spdk_nvmf_subsystem *subsystem,
|
||||
uint32_t nsid);
|
||||
|
||||
/**
|
||||
* Get the maximum number of namespaces allowed in a subsystem.
|
||||
*
|
||||
* \param subsystem Subsystem to query.
|
||||
*
|
||||
* \return Maximum number of namespaces allowed in the subsystem, or 0 for unlimited.
|
||||
*/
|
||||
uint32_t spdk_nvmf_subsystem_get_max_namespaces(const struct spdk_nvmf_subsystem *subsystem);
|
||||
|
||||
/**
|
||||
* Get a namespace's NSID.
|
||||
*
|
||||
|
@ -251,9 +251,16 @@ dump_nvmf_subsystem(struct spdk_json_write_ctx *w, struct spdk_nvmf_subsystem *s
|
||||
if (spdk_nvmf_subsystem_get_type(subsystem) == SPDK_NVMF_SUBTYPE_NVME) {
|
||||
struct spdk_nvmf_ns *ns;
|
||||
struct spdk_nvmf_ns_opts ns_opts;
|
||||
uint32_t max_namespaces;
|
||||
|
||||
spdk_json_write_name(w, "serial_number");
|
||||
spdk_json_write_string(w, spdk_nvmf_subsystem_get_sn(subsystem));
|
||||
|
||||
max_namespaces = spdk_nvmf_subsystem_get_max_namespaces(subsystem);
|
||||
if (max_namespaces != 0) {
|
||||
spdk_json_write_named_uint32(w, "max_namespaces", max_namespaces);
|
||||
}
|
||||
|
||||
spdk_json_write_name(w, "namespaces");
|
||||
spdk_json_write_array_begin(w);
|
||||
for (ns = spdk_nvmf_subsystem_get_first_ns(subsystem); ns != NULL;
|
||||
|
@ -1245,3 +1245,9 @@ spdk_nvmf_subsystem_get_ctrlr(struct spdk_nvmf_subsystem *subsystem, uint16_t cn
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_nvmf_subsystem_get_max_namespaces(const struct spdk_nvmf_subsystem *subsystem)
|
||||
{
|
||||
return subsystem->max_allowed_nsid;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user