test/vhost: allow FIO to output JSON

Add option in test/vhost/common.sh to run FIO
with --output-format=json

Change-Id: I3115cf35d48a15a539d91e21f8f128970f150467
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/416525
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Karol Latecki 2018-06-22 09:37:12 +02:00 committed by Daniel Verkamp
parent 6f8ab39534
commit 17777bcad7
2 changed files with 12 additions and 5 deletions

View File

@ -999,6 +999,7 @@ function run_fio()
mkdir -p $out
;;
--local) run_server_mode=false ;;
--json) json="--json" ;;
*)
error "Invalid argument '$arg'"
return 1
@ -1044,7 +1045,7 @@ function run_fio()
python $SPDK_BUILD_DIR/test/vhost/common/run_fio.py --job-file=/root/$job_fname \
$([[ ! -z "$fio_bin" ]] && echo "--fio-bin=$fio_bin") \
--out=$out ${fio_disks%,}
--out=$out $json ${fio_disks%,}
}
# Shutdown or kill any running VM and SPDK APP.

View File

@ -23,6 +23,7 @@ def show_help():
-f, --fio-bin Location of FIO binary on local host (Default "fio")
-o, --out Directory used to save generated job files and
files with test results
-J, --json Use JSON format for output
-p, --perf-vmex Enable aggregating statistic for VMEXITS for VMs
""")
@ -43,12 +44,14 @@ def save_file(path, mode, contents):
fh.close()
def run_fio(vms, fio_cfg_fname, out_path, perf_vmex=False):
def run_fio(vms, fio_cfg_fname, out_path, perf_vmex=False, json=False):
global fio_bin
job_name = os.path.splitext(os.path.basename(fio_cfg_fname))[0]
# Build command for FIO
fio_cmd = " ".join([fio_bin, "--eta=never"])
if json:
fio_cmd = " ".join([fio_bin, "--output-format=json"])
for vm in vms:
# vm[0] = IP address, vm[1] = Port number
fio_cmd = " ".join([fio_cmd,
@ -114,11 +117,12 @@ def main():
fio_cfg = None
out_dir = None
perf_vmex = False
json = False
try:
opts, args = getopt.getopt(sys.argv[1:], "hj:f:o:p",
opts, args = getopt.getopt(sys.argv[1:], "hJj:f:o:p",
["help", "job-file=", "fio-bin=",
"out=", "perf-vmex"])
"out=", "perf-vmex", "json"])
except getopt.GetoptError:
show_help()
sys.exit(1)
@ -139,6 +143,8 @@ def main():
out_dir = a
elif o in ("-f", "--fio-bin"):
fio_bin = a
elif o in ("-J", "--json"):
json = True
if fio_cfg is None:
print("ERROR! No FIO job provided!")
@ -155,7 +161,7 @@ def main():
vms.append((ip, port, filenames))
print("Running job file: {0}".format(fio_cfg))
run_fio(vms, fio_cfg, out_dir, perf_vmex)
run_fio(vms, fio_cfg, out_dir, perf_vmex, json)
if __name__ == "__main__":