test/json_config: Fix json_config test fail for multiple nvme disk config

In json_config test, when there are multiple nvme disks, we see errors like:

ERROR: expected event 'bdev_register:Nvme0n1p1' but got 'bdev_register:Nvme1n1' (whole event line: bdev_register:Nvme1n1:1)

The reason is when there are multiple nvme disks in the system, when
start nvmf_tgt, it will register all the disks in bdev, so there would
be multiple bdev_register events for these disks before we run
create_bdev_subsystem_config. So in create_bdev_subsystem_config we need
add these events to expected events list first.

Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: Ice8f5464975e68ae63fec891ef18dbc7590a9ab5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7858
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Rui Chang 2021-05-11 17:27:23 +08:00 committed by Tomasz Zawadzki
parent 6263457ca3
commit d424e2449a

View File

@ -150,6 +150,20 @@ function create_bdev_subsystem_config() {
local expected_notifications=()
local event_line event ev_type ev_ctx
local rc=""
# Before testing notifications generated by the operations in this function, we
# need add existing notification to the expected list first. Otherwise it would fail.
while read -r event_line; do
# remove ID
event="${event_line%:*}"
ev_type=${event%:*}
ev_ctx=${event#*:}
expected_notifications+=(${ev_type}:${ev_ctx})
done < <(tgt_rpc notify_get_notifications -i ${last_event_id} | jq -r '.[] | "\(.type):\(.ctx):\(.id)"')
if [[ $SPDK_TEST_BLOCKDEV -eq 1 ]]; then
local lvol_store_base_bdev=Nvme0n1
if ! tgt_rpc get_bdevs --name ${lvol_store_base_bdev} > /dev/null; then
@ -174,7 +188,6 @@ function create_bdev_subsystem_config() {
tgt_rpc bdev_malloc_create 16 4096 --name Malloc1
expected_notifications+=(
bdev_register:${lvol_store_base_bdev}
bdev_register:${lvol_store_base_bdev}p1
bdev_register:${lvol_store_base_bdev}p0
bdev_register:Malloc3