aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/scenarios/storage/fio.py
diff options
context:
space:
mode:
authorhoujingwen <houjingwen@huawei.com>2015-09-16 11:19:15 +0000
committerhoujingwen <houjingwen@huawei.com>2015-09-24 11:24:44 +0800
commit735af0fc05d73cbc7bd97b52a230d966cbfec6c3 (patch)
tree0bd872895a6ee0fa9088dd5c4512536f2edd85b5 /yardstick/benchmark/scenarios/storage/fio.py
parent8650a0a22182987e70f34653d8521ea2072ee5c8 (diff)
Fix bug in fio scenario
1) when duration>3600s in fio.yaml, ssh time out 2) sometimes the latency value in test result is null 3) update plot.py, fit for code update in fio.py 4) small bug in file.py (result output dump) Add --output-format=json in default args, so fio command can return json format data. JIRA: YARDSTICK-143 Change-Id: Ie02977b8c9f11986a1eed66896b84d18db3d2211 Signed-off-by: houjingwen <houjingwen@huawei.com>
Diffstat (limited to 'yardstick/benchmark/scenarios/storage/fio.py')
-rw-r--r--yardstick/benchmark/scenarios/storage/fio.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/yardstick/benchmark/scenarios/storage/fio.py b/yardstick/benchmark/scenarios/storage/fio.py
index d3695165f..42f159164 100644
--- a/yardstick/benchmark/scenarios/storage/fio.py
+++ b/yardstick/benchmark/scenarios/storage/fio.py
@@ -17,7 +17,7 @@ LOG = logging.getLogger(__name__)
class Fio(base.Scenario):
- """Execute fio benchmark on host
+ """Execute fio benchmark in a host
Parameters
filename - file name for fio workload
@@ -73,8 +73,9 @@ class Fio(base.Scenario):
def run(self, args):
"""execute the benchmark"""
- default_args = "-ioengine=libaio -direct=1 " \
- "-group_reporting -numjobs=1 -time_based"
+ default_args = "-ioengine=libaio -direct=1 -group_reporting " \
+ "-numjobs=1 -time_based --output-format=json"
+ result = {}
if not self.setup_done:
self.setup()
@@ -97,21 +98,32 @@ class Fio(base.Scenario):
else:
runtime = 30
- args = "-filename=%s -bs=%s -iodepth=%s -rw=%s -ramp_time=%s " \
- "-runtime=%s -name=%s" \
- % (filename, bs, iodepth, rw, ramp_time, runtime, name)
- cmd = "sudo bash fio.sh %s %s %s" \
- % (filename, args, default_args)
+ cmd_args = "-filename=%s -bs=%s -iodepth=%s -rw=%s -ramp_time=%s " \
+ "-runtime=%s -name=%s %s" \
+ % (filename, bs, iodepth, rw, ramp_time, runtime, name,
+ default_args)
+ cmd = "sudo bash fio.sh %s %s" % (filename, cmd_args)
LOG.debug("Executing command: %s", cmd)
- status, stdout, stderr = self.client.execute(cmd)
+ # Set timeout, so that the cmd execution does not exit incorrectly
+ # when the test run time is last long
+ timeout = int(ramp_time) + int(runtime) + 600
+ status, stdout, stderr = self.client.execute(cmd, timeout=timeout)
if status:
raise RuntimeError(stderr)
- data = json.loads(stdout)
+ 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
- return data
+ return result
def _test():
@@ -133,8 +145,9 @@ def _test():
"filename": "/home/ec2-user/data.raw",
"bs": "4k",
"iodepth": "1",
- "rw": "write",
- "ramp_time": 10,
+ "rw": "rw",
+ "ramp_time": 1,
+ "duration": 10
}
args = {"options": options}