From 6d8dc5239e10bfaac6b14bc73dfb078c64e4a1a0 Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Wed, 3 Jan 2018 11:05:35 +0100 Subject: [PATCH] test/vhost: keep fio config file name for log output Copy fio config to guest VM with the same name instead of renaming to /root/fio.job. Use the same file name for creating log file in desired directory. Remove not needed ls command in common/run_fio while at it. Change-Id: I9e13d8cd6f7892a77d89afb99f7d57ef79f7b11f Signed-off-by: Karol Latecki Reviewed-on: https://review.gerrithub.io/393469 Tested-by: SPDK Automated Test System Reviewed-by: Pawel Wodkowski Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp Reviewed-by: Changpeng Liu --- test/vhost/common/common.sh | 9 +++++---- test/vhost/common/run_fio.py | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/vhost/common/common.sh b/test/vhost/common/common.sh index 3c88c59c1..09642684e 100644 --- a/test/vhost/common/common.sh +++ b/test/vhost/common/common.sh @@ -799,19 +799,20 @@ function run_fio() esac done + local job_fname=$(basename "$job_file") + # prepare job file for each VM for vm in ${vms[@]}; do local vm_num=${vm%%:*} local vmdisks=${vm#*:} - sed "s@filename=@filename=$vmdisks@" $job_file | vm_ssh $vm_num 'cat > /root/fio.job' + sed "s@filename=@filename=$vmdisks@" $job_file | vm_ssh $vm_num "cat > /root/$job_fname" fio_disks+="127.0.0.1:$(vm_fio_socket $vm_num):$vmdisks," - vm_ssh $vm_num ls -al - vm_ssh $vm_num cat /root/fio.job + vm_ssh $vm_num cat /root/$job_fname done - python $SPDK_BUILD_DIR/test/vhost/common/run_fio.py --job-file=/root/fio.job $fio_bin $out ${fio_disks%,} + python $SPDK_BUILD_DIR/test/vhost/common/run_fio.py --job-file=/root/$job_fname $fio_bin $out ${fio_disks%,} } # Shutdown or kill any running VM and SPDK APP. diff --git a/test/vhost/common/run_fio.py b/test/vhost/common/run_fio.py index 7f4ef2c10..959369a8e 100755 --- a/test/vhost/common/run_fio.py +++ b/test/vhost/common/run_fio.py @@ -45,7 +45,7 @@ def save_file(path, mode, contents): def run_fio(vms, fio_cfg_fname, out_path, perf_vmex=False): global fio_bin - fio_cfg_prefix = fio_cfg_fname.split(".")[0] + job_name = os.path.splitext(os.path.basename(fio_cfg_fname))[0] # Build command for FIO fio_cmd = " ".join([fio_bin, "--eta=never"]) @@ -82,7 +82,7 @@ def run_fio(vms, fio_cfg_fname, out_path, perf_vmex=False): print("ERROR! While executing FIO jobs - RC: {rc}".format(rc=rc, out=out)) sys.exit(rc) else: - save_file(os.path.join(out_path, ".".join([fio_cfg_prefix, "log"])), "w", out) + save_file(os.path.join(out_path, ".".join([job_name, "log"])), "w", out) if perf_vmex: # Stop gathering perf statistics and prepare some result files @@ -96,7 +96,7 @@ def run_fio(vms, fio_cfg_fname, out_path, perf_vmex=False): blocking=True) print("VMexit host stats:") print("{perf_out}".format(perf_out=out)) - save_file(os.path.join(perf_dir, "vmexit_stats_" + fio_cfg_prefix), + save_file(os.path.join(perf_dir, "vmexit_stats_" + job_name), "w", "{perf_out}".format(perf_out=out)) try: os.remove(perf_rec_file)