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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6b7fb8fe50b19b5639169c03f5242b9d6f14128b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4390
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2020-09-24 11:10:11 +09:00 committed by Tomasz Zawadzki
parent 66e85c204c
commit 1c2a2bb7f0

View File

@ -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);