diff --git a/app/nvmf_tgt/conf.c b/app/nvmf_tgt/conf.c index e798623b6..908972d2f 100644 --- a/app/nvmf_tgt/conf.c +++ b/app/nvmf_tgt/conf.c @@ -509,6 +509,11 @@ spdk_nvmf_construct_subsystem(const char *name, } } + if (addresses[i].transport == NULL) { + SPDK_ERRLOG("Missing listen address transport type\n"); + goto error; + } + listen_addr = spdk_nvmf_tgt_listen(addresses[i].transport, addresses[i].traddr, addresses[i].trsvcid); if (listen_addr == NULL) { diff --git a/app/nvmf_tgt/nvmf_rpc.c b/app/nvmf_tgt/nvmf_rpc.c index 6fea893ef..a9ce71ae7 100644 --- a/app/nvmf_tgt/nvmf_rpc.c +++ b/app/nvmf_tgt/nvmf_rpc.c @@ -79,8 +79,11 @@ dump_nvmf_subsystem(struct spdk_json_write_ctx *w, struct nvmf_tgt_subsystem *tg TAILQ_FOREACH(allowed_listener, &subsystem->allowed_listeners, link) { listen_addr = allowed_listener->listen_addr; spdk_json_write_object_begin(w); + /* NOTE: "transport" is kept for compatibility; new code should use "trtype" */ spdk_json_write_name(w, "transport"); spdk_json_write_string(w, listen_addr->trname); + spdk_json_write_name(w, "trtype"); + spdk_json_write_string(w, listen_addr->trname); spdk_json_write_name(w, "traddr"); spdk_json_write_string(w, listen_addr->traddr); spdk_json_write_name(w, "trsvcid"); @@ -174,7 +177,9 @@ struct rpc_listen_addresses { }; static const struct spdk_json_object_decoder rpc_listen_address_decoders[] = { - {"transport", offsetof(struct rpc_listen_address, transport), spdk_json_decode_string}, + /* NOTE: "transport" is kept for compatibility; new code should use "trtype" */ + {"transport", offsetof(struct rpc_listen_address, transport), spdk_json_decode_string, true}, + {"trtype", offsetof(struct rpc_listen_address, transport), spdk_json_decode_string, true}, {"traddr", offsetof(struct rpc_listen_address, traddr), spdk_json_decode_string}, {"trsvcid", offsetof(struct rpc_listen_address, trsvcid), spdk_json_decode_string}, }; diff --git a/scripts/rpc.py b/scripts/rpc.py index 1e6d8115e..e15f742eb 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -427,9 +427,9 @@ p = subparsers.add_parser('construct_nvmf_subsystem', help='Add a nvmf subsystem p.add_argument("-c", "--core", help='The core Nvmf target run on', type=int, default=-1) p.add_argument('mode', help='Target mode: Virtual or Direct') p.add_argument('nqn', help='Target nqn(ASCII)') -p.add_argument('listen', help="""comma-separated list of Listen pairs enclosed -in quotes. Format: 'transport:transport0 traddr:traddr0 trsvcid:trsvcid0,transport:transport1 traddr:traddr1 trsvcid:trsvcid1' etc -Example: 'transport:RDMA traddr:192.168.100.8 trsvcid:4420,transport:RDMA traddr:192.168.100.9 trsvcid:4420'""") +p.add_argument('listen', help="""comma-separated list of Listen pairs enclosed +in quotes. Format: 'trtype:transport0 traddr:traddr0 trsvcid:trsvcid0,trtype:transport1 traddr:traddr1 trsvcid:trsvcid1' etc +Example: 'trtype:RDMA traddr:192.168.100.8 trsvcid:4420,trtype:RDMA traddr:192.168.100.9 trsvcid:4420'""") p.add_argument('hosts', help="""Whitespace-separated list of host nqn list. Format: 'nqn1 nqn2' etc Example: 'nqn.2016-06.io.spdk:init nqn.2016-07.io.spdk:init'""") diff --git a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh index fb624133e..5811638c8 100755 --- a/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh +++ b/test/iscsi_tgt/nvme_remote/fio_remote_nvme.sh @@ -29,7 +29,7 @@ trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid 5260 echo "NVMf target has started." bdevs=$($rpc_py construct_malloc_bdev 64 512) -$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" +$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" echo "NVMf subsystem created." timing_enter start_iscsi_tgt diff --git a/test/nvmf/discovery/discovery.sh b/test/nvmf/discovery/discovery.sh index 2aa4dd323..d984b1b9e 100755 --- a/test/nvmf/discovery/discovery.sh +++ b/test/nvmf/discovery/discovery.sh @@ -38,8 +38,8 @@ bdevs="$bdevs $($rpc_py construct_null_bdev Null1 $NULL_BDEV_SIZE $NULL_BLOCK_SI modprobe -v nvme-rdma -$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" -$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" +$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" +$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" nvme discover -t rdma -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT diff --git a/test/nvmf/filesystem/filesystem.sh b/test/nvmf/filesystem/filesystem.sh index 075f1076c..bef8c251c 100755 --- a/test/nvmf/filesystem/filesystem.sh +++ b/test/nvmf/filesystem/filesystem.sh @@ -33,8 +33,8 @@ bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SI modprobe -v nvme-rdma -$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" -$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" +$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" +$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode2" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" diff --git a/test/nvmf/fio/fio.sh b/test/nvmf/fio/fio.sh index 2d64e5b34..00387dc0f 100755 --- a/test/nvmf/fio/fio.sh +++ b/test/nvmf/fio/fio.sh @@ -33,8 +33,8 @@ bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SI modprobe -v nvme-rdma -$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" -$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" +$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" +$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode2" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" diff --git a/test/nvmf/host/aer.sh b/test/nvmf/host/aer.sh index b264c54ed..d4daa3b9c 100755 --- a/test/nvmf/host/aer.sh +++ b/test/nvmf/host/aer.sh @@ -25,7 +25,7 @@ trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} timing_exit start_nvmf_tgt -$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" +$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" $rootdir/test/lib/nvme/aer/aer -r "\ trtype:RDMA \ diff --git a/test/nvmf/host/fio.sh b/test/nvmf/host/fio.sh index 774061e70..6212544cc 100755 --- a/test/nvmf/host/fio.sh +++ b/test/nvmf/host/fio.sh @@ -30,7 +30,7 @@ trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT waitforlisten $nvmfpid ${RPC_PORT} timing_exit start_nvmf_tgt -$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" +$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin diff --git a/test/nvmf/host/identify.sh b/test/nvmf/host/identify.sh index eeaddd4f9..37da34818 100755 --- a/test/nvmf/host/identify.sh +++ b/test/nvmf/host/identify.sh @@ -30,7 +30,7 @@ timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" -$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" +$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" $rootdir/examples/nvme/identify/identify -r "\ trtype:RDMA \ diff --git a/test/nvmf/host/perf.sh b/test/nvmf/host/perf.sh index d97e6d931..bffbf88f4 100755 --- a/test/nvmf/host/perf.sh +++ b/test/nvmf/host/perf.sh @@ -30,8 +30,8 @@ timing_exit start_nvmf_tgt bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" -$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" -$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode2 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" +$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" +$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode2 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" $rootdir/examples/nvme/perf/perf -q 128 -s 4096 -w randrw -M 50 -t 1 -r "trtype:RDMA adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" sync diff --git a/test/nvmf/multiconnection/multiconnection.sh b/test/nvmf/multiconnection/multiconnection.sh index 018f69d6a..0d8418771 100755 --- a/test/nvmf/multiconnection/multiconnection.sh +++ b/test/nvmf/multiconnection/multiconnection.sh @@ -33,7 +33,7 @@ modprobe -v nvme-rdma for i in `seq 1 11` do bdevs="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" - $rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode${i} "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" '' -s SPDK${i} -n "$bdevs" + $rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode${i} "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" '' -s SPDK${i} -n "$bdevs" done for i in `seq 1 11`; do diff --git a/test/nvmf/nvme_cli/nvme_cli.sh b/test/nvmf/nvme_cli/nvme_cli.sh index 7600c53fa..849805e05 100755 --- a/test/nvmf/nvme_cli/nvme_cli.sh +++ b/test/nvmf/nvme_cli/nvme_cli.sh @@ -32,8 +32,8 @@ bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SI modprobe -v nvme-rdma -$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" -$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" +$rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "*" +$rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -s SPDK00000000000001 -n "$bdevs" nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode2" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" diff --git a/test/nvmf/rpc/rpc.sh b/test/nvmf/rpc/rpc.sh index ca04aeac6..75cedf2d9 100755 --- a/test/nvmf/rpc/rpc.sh +++ b/test/nvmf/rpc/rpc.sh @@ -41,7 +41,7 @@ do j=0 for bdf in $bdfs; do let j=j+1 - $rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode$j "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "$bdf" + $rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode$j "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -p "$bdf" done n=$j diff --git a/test/nvmf/shutdown/shutdown.sh b/test/nvmf/shutdown/shutdown.sh index 60ccc5c27..6dc5420f9 100755 --- a/test/nvmf/shutdown/shutdown.sh +++ b/test/nvmf/shutdown/shutdown.sh @@ -32,7 +32,7 @@ timing_exit start_nvmf_tgt for i in `seq 1 10` do bdevs="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" - $rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode${i} "transport:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" '' -s SPDK${i} -n "$bdevs" + $rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode${i} "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" '' -s SPDK${i} -n "$bdevs" done # Kill nvmf tgt without removing any subsystem to check whether it can shutdown correctly