Commit b556a7f9 authored by Karol Latecki's avatar Karol Latecki Committed by Tomasz Zawadzki
Browse files

scripts/gen_nvme.sh: change trid parsing



Remove using ":" as separator and instead read
variable values directly from input "dictionary"
(so to speak).

Change-Id: I6fe354477db318dbbdbb9d4138900adbd65511ff
Signed-off-by: default avatarKarol Latecki <karol.latecki@nutanix.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26815


Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarMichal Berger <michal.berger@nutanix.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz@tzawadzki.com>
parent 147abe51
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -183,7 +183,7 @@ These examples assume you have built fio and SPDK with `--with-fio` option enabl

    ```bash
    scripts/gen_nvme.sh --json-with-subsystems --mode=remote \
    --trid=tcp:10.0.0.1:4420:nqn.2018-09.io.spdk:cnode1 > /tmp/bdev.json
    --trid="transport=tcp ip_addr=10.0.0.1 svc_port=4420 nqn=nqn.2018-09.io.spdk:cnode1" > /tmp/bdev.json

    cat /tmp/bdev.json | jq
    {
+8 −8
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@ function usage() {
	echo "-h, --help                     Print help and exit"
	echo "    --mode                     Generate 'local' or 'remote' NVMe JSON configuration. Default is 'local'."
	echo "                               Remote needs --trid option to be present."
	echo "    --trid                     Comma separated list target subsystem information containing transport type,"
	echo "                               IP addresses, port numbers and NQN names."
	echo "                               Example: tcp:127.0.0.1:4420:nqn.2016-06.io.spdk:cnode1,tcp:127.0.0.1:4421:nqn.2016-06.io.spdk:cnode2"
	echo "    --trid                     Comma separated list target subsystem information containing"
	echo "                               transport type, IP addresses, port numbers and NQN names. Example:"
	echo "                               --trid=\"transport=tcp ip_addr=127.0.0.1 svc_port=4420 nqn=nqn.2016-06.io.spdk:cnode1,[...]\""
	echo "    --json-with-subsystems     Wrap bdev subsystem JSON configuration with higher level 'subsystems' dictionary."
	echo "-n, --bdev-count               Defines number of nvme bdevs to use in the configuration."
	exit 0
@@ -69,12 +69,12 @@ function create_remote_json_config() {

	IFS="," read -r -a trids <<< $1
	for ((i = 0; i < ${#trids[@]}; i++)); do
		local transport
		local ip_addr
		local svc_port
		local nqn
		local transport=""
		local ip_addr=""
		local svc_port=""
		local nqn=""

		IFS=":" read -r transport ip_addr svc_port nqn <<< ${trids[i]}
		source <(echo "${trids[i]}")
		bdev_json_cfg+=("$(
			cat <<- JSON
				{
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ spdk_dd() {

	# Disable auto-examine to avoid seeing the examine callbacks' reads in accel stats
	config=$("$rootdir/scripts/gen_nvme.sh" --mode=remote --json-with-subsystems \
		--trid="$TEST_TRANSPORT:$NVMF_FIRST_TARGET_IP:$NVMF_PORT:$nqn" \
		--trid="transport=$TEST_TRANSPORT ip_addr=$NVMF_FIRST_TARGET_IP svc_port=$NVMF_PORT nqn=$nqn" \
		| jq '.subsystems[0].config[.subsystems[0].config | length] |=
			{"method": "bdev_set_options", "params": {"bdev_auto_examine": false}}')