From c7a3775d447e29850463893495c08328960cd3d5 Mon Sep 17 00:00:00 2001 From: houjingwen Date: Thu, 8 Oct 2015 09:31:36 +0000 Subject: Fio scenario support sla JIRA: YARDSTICK-34 Change-Id: I782ba5845f8bd54a19bad078fe7be546400f7524 Signed-off-by: houjingwen --- yardstick/benchmark/scenarios/storage/fio.py | 32 +++++++++++++++++++++------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'yardstick/benchmark') diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py index 42f159164..1107a8b2c 100644 --- a/yardstick/benchmark/scenarios/storage/fio.py +++ b/yardstick/benchmark/scenarios/storage/fio.py @@ -114,14 +114,30 @@ class Fio(base.Scenario): raw_data = json.loads(stdout) # The bandwidth unit is KB/s, and latency unit is us - result["read_bw"] = raw_data["jobs"][0]["read"]["bw"] - result["read_iops"] = raw_data["jobs"][0]["read"]["iops"] - result["read_lat"] = raw_data["jobs"][0]["read"]["lat"]["mean"] - result["write_bw"] = raw_data["jobs"][0]["write"]["bw"] - result["write_iops"] = raw_data["jobs"][0]["write"]["iops"] - result["write_lat"] = raw_data["jobs"][0]["write"]["lat"]["mean"] - - # TODO: add sla check + if rw in ["read", "randread", "rw", "randrw"]: + result["read_bw"] = raw_data["jobs"][0]["read"]["bw"] + result["read_iops"] = raw_data["jobs"][0]["read"]["iops"] + result["read_lat"] = raw_data["jobs"][0]["read"]["lat"]["mean"] + if rw in ["write", "randwrite", "rw", "randrw"]: + result["write_bw"] = raw_data["jobs"][0]["write"]["bw"] + result["write_iops"] = raw_data["jobs"][0]["write"]["iops"] + result["write_lat"] = raw_data["jobs"][0]["write"]["lat"]["mean"] + + if "sla" in args: + for k, v in result.items(): + if k not in args['sla']: + continue + + if "lat" in k: + # For lattency small value is better + max_v = float(args['sla'][k]) + assert v <= max_v, "%s %f > " \ + "sla:%s(%f)" % (k, v, k, max_v) + else: + # For bandwidth and iops big value is better + min_v = int(args['sla'][k]) + assert v >= min_v, "%s %d < " \ + "sla:%s(%d)" % (k, v, k, min_v) return result -- cgit 1.2.3-korg