scripts/fio.py: add support for specifying num_jobs

This will allow us to test a greater number of connections without
having to add more subsystems when doing NVMe-oF testing.

Change-Id: I33203d6db79b30abb065f098c16840096478c5de
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451677
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2019-04-22 11:37:52 -07:00 committed by Darek Stojaczyk
parent 38527b0786
commit 0f94938a74
16 changed files with 39 additions and 35 deletions

View File

@ -17,6 +17,7 @@ direct=1
bs=%(blocksize)d bs=%(blocksize)d
iodepth=%(iodepth)d iodepth=%(iodepth)d
norandommap=%(norandommap)d norandommap=%(norandommap)d
numjobs=%(numjobs)s
%(verify)s %(verify)s
verify_dump=1 verify_dump=1
@ -44,9 +45,9 @@ def interrupt_handler(signum, frame):
def main(): def main():
global fio global fio
if (len(sys.argv) < 6): if (len(sys.argv) < 7):
print("usage:") print("usage:")
print(" " + sys.argv[0] + " <nvmf/iscsi> <io_size> <queue_depth> <test_type> <runtime>") print(" " + sys.argv[0] + " <nvmf/iscsi> <io_size> <queue_depth> <test_type> <runtime> <num_jobs>")
print("advanced usage:") print("advanced usage:")
print("If you want to run fio with verify, please add verify string after runtime.") print("If you want to run fio with verify, please add verify string after runtime.")
print("Currently fio.py only support write rw randwrite randrw with verify enabled.") print("Currently fio.py only support write rw randwrite randrw with verify enabled.")
@ -57,8 +58,10 @@ def main():
queue_depth = int(sys.argv[3]) queue_depth = int(sys.argv[3])
test_type = sys.argv[4] test_type = sys.argv[4]
runtime = sys.argv[5] runtime = sys.argv[5]
num_jobs = sys.argv[6]
verify = False verify = False
if len(sys.argv) > 6: if len(sys.argv) > 7:
verify = True verify = True
if app == "nvmf": if app == "nvmf":
@ -81,7 +84,7 @@ def main():
signal.signal(signal.SIGTERM, interrupt_handler) signal.signal(signal.SIGTERM, interrupt_handler)
signal.signal(signal.SIGINT, interrupt_handler) signal.signal(signal.SIGINT, interrupt_handler)
fio = Popen([fio_executable, '-'], stdin=PIPE) fio = Popen([fio_executable, '-'], stdin=PIPE)
fio.communicate(create_fio_config(io_size, queue_depth, device_paths, test_type, runtime, verify).encode()) fio.communicate(create_fio_config(io_size, queue_depth, device_paths, test_type, runtime, num_jobs, verify).encode())
fio.stdin.close() fio.stdin.close()
rc = fio.wait() rc = fio.wait()
print("FIO completed with code %d\n" % rc) print("FIO completed with code %d\n" % rc)
@ -99,7 +102,7 @@ def get_nvmf_target_devices():
return re.findall("(nvme[0-9]+n[0-9]+)\n", output) return re.findall("(nvme[0-9]+n[0-9]+)\n", output)
def create_fio_config(size, q_depth, devices, test, run_time, verify): def create_fio_config(size, q_depth, devices, test, run_time, num_jobs, verify):
norandommap = 0 norandommap = 0
if not verify: if not verify:
verifyfio = "" verifyfio = ""
@ -108,7 +111,8 @@ def create_fio_config(size, q_depth, devices, test, run_time, verify):
verifyfio = verify_template verifyfio = verify_template
fiofile = fio_template % {"blocksize": size, "iodepth": q_depth, fiofile = fio_template % {"blocksize": size, "iodepth": q_depth,
"testtype": test, "runtime": run_time, "testtype": test, "runtime": run_time,
"norandommap": norandommap, "verify": verifyfio} "norandommap": norandommap, "verify": verifyfio,
"numjobs": num_jobs}
for (i, dev) in enumerate(devices): for (i, dev) in enumerate(devices):
fiofile += fio_job_template % {"jobnumber": i, "device": dev} fiofile += fio_job_template % {"jobnumber": i, "device": dev}
return fiofile return fiofile

View File

@ -11,8 +11,8 @@ function node_login_fio_logout() {
done done
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
sleep 1 sleep 1
$fio_py iscsi 512 1 write 2 $fio_py iscsi 512 1 write 2 1
$fio_py iscsi 512 1 read 2 $fio_py iscsi 512 1 read 2 1
iscsiadm -m node --logout -p $TARGET_IP:$ISCSI_PORT iscsiadm -m node --logout -p $TARGET_IP:$ISCSI_PORT
sleep 1 sleep 1
} }

View File

@ -36,7 +36,7 @@ function running_config() {
timing_exit start_iscsi_tgt2 timing_exit start_iscsi_tgt2
sleep 1 sleep 1
$fio_py iscsi 4096 1 randrw 5 $fio_py iscsi 4096 1 randrw 5 1
} }
if [ -z "$TARGET_IP" ]; then if [ -z "$TARGET_IP" ]; then
@ -92,12 +92,12 @@ iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
trap "iscsicleanup; killprocess $pid; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT trap "iscsicleanup; killprocess $pid; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT
sleep 1 sleep 1
$fio_py iscsi 4096 1 randrw 1 verify $fio_py iscsi 4096 1 randrw 1 1 verify
$fio_py iscsi 131072 32 randrw 1 verify $fio_py iscsi 131072 32 randrw 1 1 verify
$fio_py iscsi 524288 128 randrw 1 verify $fio_py iscsi 524288 128 randrw 1 1 verify
if [ $RUN_NIGHTLY -eq 1 ]; then if [ $RUN_NIGHTLY -eq 1 ]; then
$fio_py iscsi 4096 1 write 300 verify $fio_py iscsi 4096 1 write 300 1 verify
# Run the running_config test which will generate a config file from the # Run the running_config test which will generate a config file from the
# running iSCSI target, then kill and restart the iSCSI target using the # running iSCSI target, then kill and restart the iSCSI target using the
@ -107,7 +107,7 @@ if [ $RUN_NIGHTLY -eq 1 ]; then
fi fi
# Start hotplug test case. # Start hotplug test case.
$fio_py iscsi 1048576 128 rw 10 & $fio_py iscsi 1048576 128 rw 10 1 &
fio_pid=$! fio_pid=$!
sleep 3 sleep 3

View File

@ -71,7 +71,7 @@ iscsiadm -m node --login -p $MIGRATION_ADDRESS:$ISCSI_PORT
# fio tests for multi-process # fio tests for multi-process
sleep 1 sleep 1
$fio_py iscsi 4096 32 randrw 10 & $fio_py iscsi 4096 32 randrw 10 1 &
fiopid=$! fiopid=$!
sleep 5 sleep 5

View File

@ -70,7 +70,7 @@ iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
timing_exit discovery timing_exit discovery
timing_enter fio timing_enter fio
$fio_py iscsi 131072 8 randwrite 10 verify $fio_py iscsi 131072 8 randwrite 10 1 verify
timing_exit fio timing_exit fio
rm -f ./local-job0-0-verify.state rm -f ./local-job0-0-verify.state

View File

@ -70,8 +70,8 @@ iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
sleep 1 sleep 1
echo "Running FIO" echo "Running FIO"
$fio_py iscsi 131072 64 randrw 5 $fio_py iscsi 131072 64 randrw 5 1
$fio_py iscsi 262144 16 randwrite 10 $fio_py iscsi 262144 16 randwrite 10 1
sync sync
trap - SIGINT SIGTERM EXIT trap - SIGINT SIGTERM EXIT

View File

@ -88,7 +88,7 @@ trap "iscsicleanup; killprocess $iscsipid; killprocess $nvmfpid; \
sleep 1 sleep 1
echo "Running FIO" echo "Running FIO"
$fio_py iscsi 4096 1 randrw 1 verify $fio_py iscsi 4096 1 randrw 1 1 verify
rm -f ./local-job0-0-verify.state rm -f ./local-job0-0-verify.state
iscsicleanup iscsicleanup
@ -97,7 +97,7 @@ killprocess $iscsipid
run_nvme_remote "remote" run_nvme_remote "remote"
echo "Running FIO" echo "Running FIO"
$fio_py iscsi 4096 1 randrw 1 verify $fio_py iscsi 4096 1 randrw 1 1 verify
rm -f ./local-job0-0-verify.state rm -f ./local-job0-0-verify.state
trap - SIGINT SIGTERM EXIT trap - SIGINT SIGTERM EXIT

View File

@ -54,7 +54,7 @@ iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
timing_exit discovery timing_exit discovery
timing_enter fio_test timing_enter fio_test
$fio_py iscsi $BLOCKSIZE 64 randwrite $RUNTIME verify $fio_py iscsi $BLOCKSIZE 64 randwrite $RUNTIME 1 verify
timing_exit fio_test timing_exit fio_test
iscsicleanup iscsicleanup

View File

@ -21,7 +21,7 @@ function check_qos_works_well() {
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read') start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read')
fi fi
$fio_py iscsi 1024 128 randread 5 $fio_py iscsi 1024 128 randread 5 1
if [ $LIMIT_TYPE = IOPS ]; then if [ $LIMIT_TYPE = IOPS ]; then
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops') end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')

View File

@ -51,8 +51,8 @@ iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
trap "iscsicleanup; killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT trap "iscsicleanup; killprocess $pid; rbd_cleanup; exit 1" SIGINT SIGTERM EXIT
sleep 1 sleep 1
$fio_py iscsi 4096 1 randrw 1 verify $fio_py iscsi 4096 1 randrw 1 1 verify
$fio_py iscsi 131072 32 randrw 1 verify $fio_py iscsi 131072 32 randrw 1 1 verify
rm -f ./local-job0-0-verify.state rm -f ./local-job0-0-verify.state

View File

@ -50,7 +50,7 @@ sleep 1
dev=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}') dev=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')
sleep 1 sleep 1
$fio_py iscsi 512 1 read 60 & $fio_py iscsi 512 1 read 60 1 &
fiopid=$! fiopid=$!
echo "FIO pid: $fiopid" echo "FIO pid: $fiopid"

View File

@ -71,7 +71,7 @@ echo "Trace record pid: $record_pid"
trap "iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT trap "iscsicleanup; killprocess $iscsi_pid; killprocess $record_pid; delete_tmp_files; exit 1" SIGINT SIGTERM EXIT
echo "Running FIO" echo "Running FIO"
$fio_py iscsi 131072 32 randrw 1 $fio_py iscsi 131072 32 randrw 1 1
iscsicleanup iscsicleanup
# Delete Malloc blockdevs and targets # Delete Malloc blockdevs and targets

View File

@ -60,15 +60,15 @@ waitforblk "nvme0n1"
waitforblk "nvme0n2" waitforblk "nvme0n2"
waitforblk "nvme0n3" waitforblk "nvme0n3"
$rootdir/scripts/fio.py nvmf 4096 1 write 1 verify $rootdir/scripts/fio.py nvmf 4096 1 write 1 1 verify
$rootdir/scripts/fio.py nvmf 4096 1 randwrite 1 verify $rootdir/scripts/fio.py nvmf 4096 1 randwrite 1 1 verify
$rootdir/scripts/fio.py nvmf 4096 128 write 1 verify $rootdir/scripts/fio.py nvmf 4096 128 write 1 1 verify
$rootdir/scripts/fio.py nvmf 4096 128 randwrite 1 verify $rootdir/scripts/fio.py nvmf 4096 128 randwrite 1 1 verify
sync sync
#start hotplug test case #start hotplug test case
$rootdir/scripts/fio.py nvmf 4096 1 read 10 & $rootdir/scripts/fio.py nvmf 4096 1 read 10 1 &
fio_pid=$! fio_pid=$!
sleep 3 sleep 3

View File

@ -99,7 +99,7 @@ for i in `seq 1 $SUBSYS_NR`; do
done done
done done
$rootdir/scripts/fio.py nvmf 262144 64 randwrite 10 verify $rootdir/scripts/fio.py nvmf 262144 64 randwrite 10 1 verify
sync sync
disconnect_nvmf disconnect_nvmf

View File

@ -63,8 +63,8 @@ for i in `seq 1 $NVMF_SUBSYS`; do
waitforblk "nvme${k}n1" waitforblk "nvme${k}n1"
done done
$rootdir/scripts/fio.py nvmf 262144 64 read 10 $rootdir/scripts/fio.py nvmf 262144 64 read 10 1
$rootdir/scripts/fio.py nvmf 262144 64 randwrite 10 $rootdir/scripts/fio.py nvmf 262144 64 randwrite 10 1
sync sync
for i in `seq 1 $NVMF_SUBSYS`; do for i in `seq 1 $NVMF_SUBSYS`; do

View File

@ -73,7 +73,7 @@ if [ ! -z $NVMF_SECOND_TARGET_IP ]; then
waitforblk "nvme0n1" waitforblk "nvme0n1"
$rootdir/scripts/fio.py nvmf 4096 1 write 1 verify $rootdir/scripts/fio.py nvmf 4096 1 write 1 1 verify
fi fi
nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true