diff options
author | houjingwen <houjingwen@huawei.com> | 2015-10-14 02:08:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-10-14 02:08:00 +0000 |
commit | 3bca848a141ba2728d036a1423b514027b0e4b98 (patch) | |
tree | 61dac40ebb5580120b840472807add5bedbba847 /yardstick | |
parent | 976b99c1c8ed80210d37e418f630f9c64879cd63 (diff) | |
parent | c7a3775d447e29850463893495c08328960cd3d5 (diff) |
Merge "Fio scenario support sla"
Diffstat (limited to 'yardstick')
-rw-r--r-- | yardstick/benchmark/scenarios/storage/fio.py | 32 |
1 files changed, 24 insertions, 8 deletions
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 |