script/gen_nvme: do not generate legacy configuration

gen_nvme.sh will no longer generate the legacy configuration.
"--json" option will still work for any current users of the script.

Tests were modified to no longer use the "--json" option.
Meanwhile others were simplified with switch to "--json-with-subsystems".

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I8450be98660e54c64c27d8401fc40d649f9403ea
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4802
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: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-10-21 06:59:09 -04:00 committed by Jim Harris
parent 2903c65533
commit 8c3e71f0f9
22 changed files with 24 additions and 47 deletions

View File

@ -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(" <path to spdk>/scripts/gen_nvme.sh --json > blobcli.json\n");
printf(" <path to spdk>/scripts/gen_nvme.sh --json-with-subsystems > blobcli.json\n");
printf("and then re-run the cli tool.\n");
exit(-1);
}

View File

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

View File

@ -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() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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..."

View File

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

View File

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

View File

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

View File

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

View File

@ -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}")

View File

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

View File

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

View File

@ -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
"

View File

@ -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"

View File

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

View File

@ -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"

View File

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

View File

@ -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}