diff --git a/examples/blob/cli/blobcli.c b/examples/blob/cli/blobcli.c index 2a4283760e..4c81cec4fc 100644 --- a/examples/blob/cli/blobcli.c +++ b/examples/blob/cli/blobcli.c @@ -1523,7 +1523,7 @@ main(int argc, char **argv) if (access(cli_context->config_file, F_OK) == -1) { printf("Error: No config file found.\n"); printf("To create a config file named 'blobcli.json' for your NVMe device:\n"); - printf(" /scripts/gen_nvme.sh --json > blobcli.json\n"); + printf(" /scripts/gen_nvme.sh --json-with-subsystems > blobcli.json\n"); printf("and then re-run the cli tool.\n"); exit(-1); } diff --git a/scripts/gen_nvme.sh b/scripts/gen_nvme.sh index 47b72c31d0..d3dddacc3a 100755 --- a/scripts/gen_nvme.sh +++ b/scripts/gen_nvme.sh @@ -5,13 +5,6 @@ set -e rootdir=$(readlink -f $(dirname $0))/.. source "$rootdir/scripts/common.sh" -function create_classic_config() { - echo "[Nvme]" - for ((i = 0; i < ${#bdfs[@]}; i++)); do - echo " TransportID \"trtype:PCIe traddr:${bdfs[i]}\" Nvme$i" - done -} - function create_json_config() { local bdev_json_cfg=() @@ -53,10 +46,8 @@ function create_json_config_with_subsystems() { bdfs=($(nvme_in_userspace)) -if [ "$1" = "--json" ]; then - create_json_config -elif [ "$1" = "--json-with-subsystems" ]; then +if [[ "$1" = "--json-with-subsystems" ]]; then create_json_config_with_subsystems else - create_classic_config + create_json_config fi diff --git a/test/bdev/blockdev.sh b/test/bdev/blockdev.sh index 26fbab8da8..755f4da464 100755 --- a/test/bdev/blockdev.sh +++ b/test/bdev/blockdev.sh @@ -49,7 +49,7 @@ function setup_bdev_conf() { } function setup_nvme_conf() { - "$rootdir/scripts/gen_nvme.sh" --json | "$rpc_py" load_subsystem_config + "$rootdir/scripts/gen_nvme.sh" | "$rpc_py" load_subsystem_config } function setup_gpt_conf() { diff --git a/test/blobfs/rocksdb/rocksdb.sh b/test/blobfs/rocksdb/rocksdb.sh index 02300f0563..8ae3414752 100755 --- a/test/blobfs/rocksdb/rocksdb.sh +++ b/test/blobfs/rocksdb/rocksdb.sh @@ -75,9 +75,7 @@ popd timing_exit db_bench_build -echo '{"subsystems": [' > $ROCKSDB_CONF -$rootdir/scripts/gen_nvme.sh --json >> $ROCKSDB_CONF -echo ']}' >> $ROCKSDB_CONF +$rootdir/scripts/gen_nvme.sh --json-with-subsystems > $ROCKSDB_CONF trap 'dump_db_bench_on_err; run_bsdump || :; rm -f $ROCKSDB_CONF; sanitize_results; exit 1' SIGINT SIGTERM EXIT diff --git a/test/blobstore/blobstore.sh b/test/blobstore/blobstore.sh index a50eb2ac6f..52799649a2 100755 --- a/test/blobstore/blobstore.sh +++ b/test/blobstore/blobstore.sh @@ -11,9 +11,7 @@ rootdir=$(readlink -f $testdir/../..) source $rootdir/test/common/autotest_common.sh # Nvme0 target configuration -echo '{"subsystems": [' > $testdir/blobcli.json -$rootdir/scripts/gen_nvme.sh --json | jq -r "del(.config[] | select(.params.name!=\"Nvme0\"))" >> $testdir/blobcli.json -echo ']}' >> $testdir/blobcli.json +$rootdir/scripts/gen_nvme.sh --json-with-subsystems > $testdir/blobcli.json # generate random data file for import/export diff dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1 diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 7bf1543386..195a7d80ed 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -1264,7 +1264,7 @@ function get_nvme_ctrlr_from_bdf() { # uio-pci-generic or vfio-pci function get_nvme_bdfs() { xtrace_disable - bdfs=$(jq -r .config[].params.traddr <<< $($rootdir/scripts/gen_nvme.sh --json)) + bdfs=$(jq -r .config[].params.traddr <<< $($rootdir/scripts/gen_nvme.sh)) if [[ -z $bdfs ]]; then echo "No devices to test on!" exit 1 diff --git a/test/compress/compress.sh b/test/compress/compress.sh index 0c67f70212..ae18778d6b 100755 --- a/test/compress/compress.sh +++ b/test/compress/compress.sh @@ -25,7 +25,7 @@ function destroy_vols() { } function create_vols() { - $rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config + $rootdir/scripts/gen_nvme.sh | $rpc_py load_subsystem_config waitforbdev Nvme0n1 $rpc_py bdev_lvol_create_lvstore Nvme0n1 lvs0 diff --git a/test/ftl/ftl.sh b/test/ftl/ftl.sh index b432bdfb0b..a474e56567 100755 --- a/test/ftl/ftl.sh +++ b/test/ftl/ftl.sh @@ -30,7 +30,7 @@ trap 'at_ftl_exit' SIGINT SIGTERM EXIT PCI_WHITELIST="$device" PCI_BLACKLIST="" DRIVER_OVERRIDE="" $rootdir/scripts/setup.sh # Use first regular NVMe disk (non-OC) as non-volatile cache -nvme_disks=$($rootdir/scripts/gen_nvme.sh --json | jq -r \ +nvme_disks=$($rootdir/scripts/gen_nvme.sh | jq -r \ ".config[] | select(.params.traddr != \"$device\").params.traddr") for disk in $nvme_disks; do diff --git a/test/iscsi_tgt/ext4test/ext4test.sh b/test/iscsi_tgt/ext4test/ext4test.sh index 600517a43c..7493a771f6 100755 --- a/test/iscsi_tgt/ext4test/ext4test.sh +++ b/test/iscsi_tgt/ext4test/ext4test.sh @@ -21,7 +21,7 @@ trap '$rpc_py bdev_split_delete Name0n1 || true; killprocess $pid; iscsitestfini waitforlisten $pid $rpc_py iscsi_set_options -o 30 -a 4 -b $node_base $rpc_py framework_start_init -$rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config +$rootdir/scripts/gen_nvme.sh | $rpc_py load_subsystem_config $rpc_py bdev_malloc_create 512 4096 --name Malloc0 echo "iscsi_tgt is listening. Running tests..." diff --git a/test/iscsi_tgt/multiconnection/multiconnection.sh b/test/iscsi_tgt/multiconnection/multiconnection.sh index 886ca74e8f..09cc9a2fb6 100755 --- a/test/iscsi_tgt/multiconnection/multiconnection.sh +++ b/test/iscsi_tgt/multiconnection/multiconnection.sh @@ -41,7 +41,7 @@ trap 'remove_backends; iscsicleanup; killprocess $iscsipid; iscsitestfini; exit waitforlisten $iscsipid $rpc_py iscsi_set_options -o 30 -a 128 $rpc_py framework_start_init -$rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config +$rootdir/scripts/gen_nvme.sh | $rpc_py load_subsystem_config timing_exit start_iscsi_tgt $rpc_py iscsi_create_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT diff --git a/test/iscsi_tgt/perf/iscsi_target.sh b/test/iscsi_tgt/perf/iscsi_target.sh index ec02f9e0c1..91720fac11 100755 --- a/test/iscsi_tgt/perf/iscsi_target.sh +++ b/test/iscsi_tgt/perf/iscsi_target.sh @@ -101,7 +101,7 @@ trap 'rm -f $testdir/perf.job; killprocess $pid; print_backtrace; exit 1' ERR SI waitforlisten "$pid" "$testdir/rpc_iscsi.sock" $rpc_py iscsi_set_options -b "iqn.2016-06.io.spdk" -f "/usr/local/etc/spdk/auth.conf" -o 30 -i -l 0 -a 16 $rpc_py framework_start_init -$rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config +$rootdir/scripts/gen_nvme.sh | $rpc_py load_subsystem_config sleep 1 timing_exit run_iscsi_app diff --git a/test/json_config/json_config.sh b/test/json_config/json_config.sh index 131db7dc5f..81c7922810 100755 --- a/test/json_config/json_config.sh +++ b/test/json_config/json_config.sh @@ -336,9 +336,7 @@ function json_config_test_init() { # Load nvme configuration. The load_config will issue framework_start_init automatically ( - echo '{"subsystems": [' - $rootdir/scripts/gen_nvme.sh --json | jq -r "del(.config[] | select(.params.name!=\"Nvme0\"))" - echo ']}' + $rootdir/scripts/gen_nvme.sh --json-with-subsystems ) | tgt_rpc load_config tgt_check_notification_types diff --git a/test/nvmf/host/perf.sh b/test/nvmf/host/perf.sh index 4d70bd83dc..2282aeb8d8 100755 --- a/test/nvmf/host/perf.sh +++ b/test/nvmf/host/perf.sh @@ -13,7 +13,7 @@ rpc_py="$rootdir/scripts/rpc.py" nvmftestinit nvmfappstart -m 0xF -$rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config +$rootdir/scripts/gen_nvme.sh | $rpc_py load_subsystem_config local_nvme_trid="trtype:PCIe traddr:"$($rpc_py framework_get_config bdev | jq -r '.[].params | select(.name=="Nvme0").traddr') bdevs="$bdevs $($rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" diff --git a/test/ocf/integrity/fio-modes.sh b/test/ocf/integrity/fio-modes.sh index 0c90f999f3..b3801d33c5 100755 --- a/test/ocf/integrity/fio-modes.sh +++ b/test/ocf/integrity/fio-modes.sh @@ -28,7 +28,7 @@ ocf_names[2]=WT_Nvme ocf_modes[2]=wt ocf_names[3]=WB_Nvme0 ocf_modes[3]=wb ocf_names[4]=WB_Nvme1 ocf_modes[4]=wb -mapfile -t config < <("$rootdir/scripts/gen_nvme.sh" --json) +mapfile -t config < <("$rootdir/scripts/gen_nvme.sh") # Drop anything from last closing ] so we can inject our own config pieces ... config=("${config[@]::${#config[@]}-2}") diff --git a/test/ocf/management/persistent-metadata.sh b/test/ocf/management/persistent-metadata.sh index cbfcab3418..6cecc9739f 100755 --- a/test/ocf/management/persistent-metadata.sh +++ b/test/ocf/management/persistent-metadata.sh @@ -11,7 +11,7 @@ rpc_py=$rootdir/scripts/rpc.py $rootdir/scripts/setup.sh -mapfile -t config < <("$rootdir/scripts/gen_nvme.sh" --json) +mapfile -t config < <("$rootdir/scripts/gen_nvme.sh") # Drop anything from last closing ] so we can inject our own config pieces ... config=("${config[@]::${#config[@]}-2}") # ... and now convert entire array to a single string item diff --git a/test/openstack/run_openstack_tests.sh b/test/openstack/run_openstack_tests.sh index 3bbd57d293..b96adafbc0 100755 --- a/test/openstack/run_openstack_tests.sh +++ b/test/openstack/run_openstack_tests.sh @@ -17,11 +17,7 @@ function finish_test() { } || : } -cat <<- JSON > "$testdir/conf.json" - {"subsystems":[ - $("$rootdir/scripts/gen_nvme.sh" --json) - ]} -JSON +$rootdir/scripts/gen_nvme.sh --json-with-subsystems > $testdir/conf.json nvmfappstart -m 0x3 -p 0 -s 1024 --json $testdir/conf.json diff --git a/test/spdkcli/vhost.sh b/test/spdkcli/vhost.sh index 809a322f82..cb95c27c9f 100755 --- a/test/spdkcli/vhost.sh +++ b/test/spdkcli/vhost.sh @@ -33,8 +33,8 @@ dd if=/dev/zero of="$sample_aio2" bs=2048 count=5000 $spdkcli_job "'/bdevs/aio create sample0 $sample_aio 512' 'sample0' True '/bdevs/aio create sample1 $sample_aio2 512' 'sample1' True " -trtype=$($rootdir/scripts/gen_nvme.sh --json | jq -r '.config[].params | select(.name=="Nvme0").trtype') -traddr=$($rootdir/scripts/gen_nvme.sh --json | jq -r '.config[].params | select(.name=="Nvme0").traddr') +trtype=$($rootdir/scripts/gen_nvme.sh | jq -r '.config[].params | select(.name=="Nvme0").trtype') +traddr=$($rootdir/scripts/gen_nvme.sh | jq -r '.config[].params | select(.name=="Nvme0").traddr') $spdkcli_job "'/bdevs/nvme create Nvme0 $trtype $traddr' 'Nvme0' True '/bdevs/split_disk bdev_split_create Nvme0n1 4' 'Nvme0n1p0' True " diff --git a/test/vhost/common.sh b/test/vhost/common.sh index ecc1425786..7e724796b4 100644 --- a/test/vhost/common.sh +++ b/test/vhost/common.sh @@ -157,7 +157,7 @@ function vhost_run() { waitforlisten "$vhost_pid" "$vhost_dir/rpc.sock" #do not generate nvmes if pci access is disabled if [[ "$cmd" != *"--no-pci"* ]] && [[ "$cmd" != *"-u"* ]] && $run_gen_nvme; then - $rootdir/scripts/gen_nvme.sh "--json" | $rootdir/scripts/rpc.py -s $vhost_dir/rpc.sock load_subsystem_config + $rootdir/scripts/gen_nvme.sh | $rootdir/scripts/rpc.py -s $vhost_dir/rpc.sock load_subsystem_config fi notice "vhost started - pid=$vhost_pid" diff --git a/test/vhost/initiator/blockdev.sh b/test/vhost/initiator/blockdev.sh index 9667f1f3da..37f4c5ebf3 100755 --- a/test/vhost/initiator/blockdev.sh +++ b/test/vhost/initiator/blockdev.sh @@ -23,7 +23,7 @@ $SPDK_BIN_DIR/vhost & vhost_pid=$! waitforlisten $vhost_pid -$rootdir/scripts/gen_nvme.sh --json | $rootdir/scripts/rpc.py load_subsystem_config +$rootdir/scripts/gen_nvme.sh | $rootdir/scripts/rpc.py load_subsystem_config if [ -z "$(rpc_cmd bdev_get_bdevs | jq '.[] | select(.name=="Nvme0n1")')" ]; then echo "Nvme0n1 bdev not found!" && false fi diff --git a/test/vhost/migration/migration-tc2.sh b/test/vhost/migration/migration-tc2.sh index aa234d842c..b8e70b784f 100644 --- a/test/vhost/migration/migration-tc2.sh +++ b/test/vhost/migration/migration-tc2.sh @@ -96,7 +96,7 @@ function migration_tc2_configure_vhost() { waitforlisten "$nvmf_tgt_pid" "$nvmf_dir/rpc.sock" $rpc_nvmf framework_start_init $rpc_nvmf nvmf_create_transport -t RDMA -u 8192 - $rootdir/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config + $rootdir/scripts/gen_nvme.sh | $rpc_nvmf load_subsystem_config timing_exit start_nvmf_tgt vhost_run 0 "-m 0x1 -s 512 -u" diff --git a/test/vhost/migration/migration-tc3a.sh b/test/vhost/migration/migration-tc3a.sh index b8f06a8d04..b0542cc210 100644 --- a/test/vhost/migration/migration-tc3a.sh +++ b/test/vhost/migration/migration-tc3a.sh @@ -105,7 +105,7 @@ function host1_start_nvmf() { waitforlisten "$nvmf_tgt_pid" "$nvmf_dir/nvmf_rpc.sock" $rpc_nvmf framework_start_init $rpc_nvmf nvmf_create_transport -t RDMA -u 8192 - $rootdir/scripts/gen_nvme.sh --json | $rpc_nvmf load_subsystem_config + $rootdir/scripts/gen_nvme.sh | $rpc_nvmf load_subsystem_config $rpc_nvmf nvmf_create_subsystem nqn.2018-02.io.spdk:cnode1 -a -s SPDK01 $rpc_nvmf nvmf_subsystem_add_ns nqn.2018-02.io.spdk:cnode1 Nvme0n1 diff --git a/test/vhost/perf_bench/vhost_perf.sh b/test/vhost/perf_bench/vhost_perf.sh index 98c6a8e3c7..abbbc28486 100755 --- a/test/vhost/perf_bench/vhost_perf.sh +++ b/test/vhost/perf_bench/vhost_perf.sh @@ -217,11 +217,7 @@ if [[ $run_precondition == true ]]; then # Using the same precondition routine possible for lvols thanks # to --clear-method option. Lvols should not UNMAP on creation. json_cfg=$rootdir/nvme.json - cat <<- JSON > "$json_cfg" - {"subsystems":[ - $("$rootdir/scripts/gen_nvme.sh" --json) - ]} - JSON + $rootdir/scripts/gen_nvme.sh --json-with-subsystems > "$json_cfg" mapfile -t nvmes < <(grep -oP "Nvme\d+" "$json_cfg") fio_filename=$(printf ":%sn1" "${nvmes[@]}") fio_filename=${fio_filename:1}