Commit 1c2a2bb7 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Move TRID type check from bdev_nvme_create() to bdev_nvme_add_trid()



This clean up the code a little more. Use the term failover instead
of multipath in the error message.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6b7fb8fe50b19b5639169c03f5242b9d6f14128b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4390


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 66e85c20
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -1786,6 +1786,11 @@ bdev_nvme_add_trid(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr, struct spdk_nvme_tra

	assert(nvme_bdev_ctrlr != NULL);

	if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
		SPDK_ERRLOG("PCIe failover is not supported.\n");
		return -ENOTSUP;
	}

	/* Currently we only support failover to the same transport type. */
	if (nvme_bdev_ctrlr->connected_trid->trtype != trid->trtype) {
		return -EINVAL;
@@ -1929,12 +1934,6 @@ bdev_nvme_create(struct spdk_nvme_transport_id *trid,

	existing_ctrlr = nvme_bdev_ctrlr_get_by_name(base_name);
	if (existing_ctrlr) {
		if (trid->trtype == SPDK_NVME_TRANSPORT_PCIE) {
			SPDK_ERRLOG("A controller with the provided name (name: %s) already exists with transport type PCIe. PCIe multipath is not supported.\n",
				    base_name);
			free(ctx);
			return -EEXIST;
		}
		rc = bdev_nvme_add_trid(existing_ctrlr, trid);
		if (rc) {
			free(ctx);