Commit 194d6af6 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

nvmf: allow setting namespace UUID in config file



Change-Id: I768129eec3b08c43ef27c3ba8c237d77ebd49178
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/414681


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent c06345bf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -133,9 +133,9 @@
#   The user must specify a bdev name for each namespace, and may optionally
#   specify a namespace ID. If nsid is omitted, the namespace will be
#   assigned the next available NSID. The NSID must be unique within the
#   subsystem.
#   subsystem. An optional namespace UUID may also be specified.
#   Syntax:
#     Namespace <bdev_name> [<nsid>]
#     Namespace <bdev_name> [<nsid> [<uuid>]]

# Namespaces backed by physical NVMe devices
[Subsystem1]
+11 −0
Original line number Diff line number Diff line
@@ -279,6 +279,7 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
		struct spdk_nvmf_ns_opts ns_opts;
		struct spdk_bdev *bdev;
		const char *bdev_name;
		const char *uuid_str;
		char *nsid_str;

		bdev_name = spdk_conf_section_get_nmval(sp, "Namespace", i, 0);
@@ -311,6 +312,16 @@ spdk_nvmf_parse_subsystem(struct spdk_conf_section *sp)
			ns_opts.nsid = (uint32_t)nsid_ul;
		}

		uuid_str = spdk_conf_section_get_nmval(sp, "Namespace", i, 2);
		if (uuid_str) {
			if (spdk_uuid_parse(&ns_opts.uuid, uuid_str)) {
				SPDK_ERRLOG("Invalid UUID %s\n", uuid_str);
				spdk_nvmf_subsystem_destroy(subsystem);
				subsystem = NULL;
				goto done;
			}
		}

		if (spdk_nvmf_subsystem_add_ns(subsystem, bdev, &ns_opts, sizeof(ns_opts)) == 0) {
			SPDK_ERRLOG("Unable to add namespace\n");
			spdk_nvmf_subsystem_destroy(subsystem);