Commit 17777bca authored by Karol Latecki's avatar Karol Latecki Committed by Daniel Verkamp
Browse files

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: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/416525


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarSeth Howell <seth.howell5141@gmail.com>
Reviewed-by: default avatarJohn Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 6f8ab395
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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.
+10 −4
Original line number Diff line number Diff line
@@ -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__":