ut/bdev_nvme: Populate namespaces by default when attaching ctrlr

Previously when attaching a ctrlr, all namespaces had not been
populated. Hence we had to populate each namespace manually.

It is more normal if all namespaces are populated when attaching the
corresponding ctrlr.

This patch does such change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I55d9c444c492ba6e44a609eac81b1ef25a7190a8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7313
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2021-04-11 02:50:50 +09:00 committed by Jim Harris
parent 924081cec9
commit b96c0b2707

View File

@ -388,6 +388,8 @@ ut_attach_ctrlr(const struct spdk_nvme_transport_id *trid, uint32_t num_ns)
for (i = 0; i < num_ns; i++) { for (i = 0; i < num_ns; i++) {
ctrlr->ns[i].id = i + 1; ctrlr->ns[i].id = i + 1;
ctrlr->ns[i].ctrlr = ctrlr; ctrlr->ns[i].ctrlr = ctrlr;
ctrlr->ns[i].is_active = true;
ctrlr->nsdata[i].nsze = 1024;
} }
} }
@ -1501,7 +1503,6 @@ test_attach_ctrlr(void)
ctrlr = ut_attach_ctrlr(&trid, 1); ctrlr = ut_attach_ctrlr(&trid, 1);
SPDK_CU_ASSERT_FATAL(ctrlr != NULL); SPDK_CU_ASSERT_FATAL(ctrlr != NULL);
ctrlr->ns[0].is_active = true;
g_ut_attach_bdev_count = 1; g_ut_attach_bdev_count = 1;
rc = bdev_nvme_create(&trid, &hostid, "nvme0", attached_names, 32, NULL, 0, rc = bdev_nvme_create(&trid, &hostid, "nvme0", attached_names, 32, NULL, 0,
@ -1536,7 +1537,6 @@ test_attach_ctrlr(void)
ctrlr = ut_attach_ctrlr(&trid, 1); ctrlr = ut_attach_ctrlr(&trid, 1);
SPDK_CU_ASSERT_FATAL(ctrlr != NULL); SPDK_CU_ASSERT_FATAL(ctrlr != NULL);
ctrlr->ns[0].is_active = true;
g_ut_register_bdev_status = -EINVAL; g_ut_register_bdev_status = -EINVAL;
g_ut_attach_bdev_count = 0; g_ut_attach_bdev_count = 0;
@ -1643,11 +1643,7 @@ test_aer_cb(void)
ctrlr = ut_attach_ctrlr(&trid, 4); ctrlr = ut_attach_ctrlr(&trid, 4);
SPDK_CU_ASSERT_FATAL(ctrlr != NULL); SPDK_CU_ASSERT_FATAL(ctrlr != NULL);
ctrlr->ns[1].is_active = true; ctrlr->ns[0].is_active = false;
ctrlr->ns[2].is_active = true;
ctrlr->ns[3].is_active = true;
ctrlr->nsdata[3].nsze = 1024;
g_ut_attach_ctrlr_status = 0; g_ut_attach_ctrlr_status = 0;
g_ut_attach_bdev_count = 3; g_ut_attach_bdev_count = 3;
@ -1825,7 +1821,6 @@ test_submit_nvme_cmd(void)
ctrlr = ut_attach_ctrlr(&trid, 1); ctrlr = ut_attach_ctrlr(&trid, 1);
SPDK_CU_ASSERT_FATAL(ctrlr != NULL); SPDK_CU_ASSERT_FATAL(ctrlr != NULL);
ctrlr->ns[0].is_active = true;
g_ut_attach_ctrlr_status = 0; g_ut_attach_ctrlr_status = 0;
g_ut_attach_bdev_count = 1; g_ut_attach_bdev_count = 1;
@ -1990,7 +1985,6 @@ test_abort(void)
ctrlr = ut_attach_ctrlr(&trid, 1); ctrlr = ut_attach_ctrlr(&trid, 1);
SPDK_CU_ASSERT_FATAL(ctrlr != NULL); SPDK_CU_ASSERT_FATAL(ctrlr != NULL);
ctrlr->ns[0].is_active = true;
g_ut_attach_ctrlr_status = 0; g_ut_attach_ctrlr_status = 0;
g_ut_attach_bdev_count = 1; g_ut_attach_bdev_count = 1;
@ -2195,8 +2189,6 @@ test_bdev_unregister(void)
ctrlr = ut_attach_ctrlr(&trid, 2); ctrlr = ut_attach_ctrlr(&trid, 2);
SPDK_CU_ASSERT_FATAL(ctrlr != NULL); SPDK_CU_ASSERT_FATAL(ctrlr != NULL);
ctrlr->ns[0].is_active = true;
ctrlr->ns[1].is_active = true;
g_ut_attach_ctrlr_status = 0; g_ut_attach_ctrlr_status = 0;
g_ut_attach_bdev_count = 2; g_ut_attach_bdev_count = 2;