summaryrefslogtreecommitdiffstats
path: root/glustolibs-io
diff options
context:
space:
mode:
authorArthy Loganathan <aloganat@redhat.com>2017-10-10 14:03:06 +0530
committerArthy Loganathan <aloganat@redhat.com>2017-10-10 14:06:52 +0530
commitda9eff9516ffd132f26c11e4e48b167bc2c74beb (patch)
treecd7c8cf5c7c58488b7f670c812d75c0bcf4a08d4 /glustolibs-io
parent0c12155457af7ee0ddafd5311cac9a238fc5d00f (diff)
Script to run fio tool using ini job file
Change-Id: Ie8237836a41d39de0de84b1d4d4b49f9af74b237 Signed-off-by: Arthy Loganathan <aloganat@redhat.com>
Diffstat (limited to 'glustolibs-io')
-rw-r--r--glustolibs-io/shared_files/io_config.yml38
-rw-r--r--glustolibs-io/shared_files/tools/fio/generic_workload_fio_job.ini9
-rw-r--r--glustolibs-io/shared_files/tools/fio/large_files_fio_job.ini9
-rw-r--r--glustolibs-io/shared_files/tools/fio/run_fio.py73
-rw-r--r--glustolibs-io/shared_files/tools/fio/small_files_fio_job.ini8
5 files changed, 137 insertions, 0 deletions
diff --git a/glustolibs-io/shared_files/io_config.yml b/glustolibs-io/shared_files/io_config.yml
new file mode 100644
index 0000000..27c930a
--- /dev/null
+++ b/glustolibs-io/shared_files/io_config.yml
@@ -0,0 +1,38 @@
+# Config yaml file for IO's
+
+io:
+ tools:
+ fio:
+ script_path : "/usr/share/glustolibs/io/tools/fio/run_fio.py"
+ job_files :
+ small_files: ['/usr/share/glustolibs/io/tools/fio/small_file_fio_job.ini']
+ large_files: ['/usr/share/glustolibs/io/tools/fio/large_file_fio_job.ini']
+ generic_workload: ['/usr/share/glustolibs/io/tools/fio/generic_workload_fio_job.ini']
+
+ scripts:
+ fd_writes:
+ script_path : "/usr/share/glustolibs/io/scripts/fd_writes.py"
+ generate_io:
+ script_path : "/usr/share/glustolibs/io/scripts/generate_io.py"
+ file_dir_ops:
+ script_path : "/usr/share/glustolibs/io/scripts/file_dir_ops.py"
+
+ workload:
+ small_files:
+ - fio
+ - fd_writes
+ - file_dir_ops
+ - small_file_generator
+
+ large_files:
+ - fio
+ - iozone
+ - bonnie
+
+ generic_workload:
+ - fio
+ - fd_writes
+ - file_dir_ops
+ - small_file_generator
+ - iozone
+ - bonnie
diff --git a/glustolibs-io/shared_files/tools/fio/generic_workload_fio_job.ini b/glustolibs-io/shared_files/tools/fio/generic_workload_fio_job.ini
new file mode 100644
index 0000000..63b9754
--- /dev/null
+++ b/glustolibs-io/shared_files/tools/fio/generic_workload_fio_job.ini
@@ -0,0 +1,9 @@
+#Sample fio job file for generating IO's of filesize 100m
+[global]
+rw=write
+fsync_on_close=1
+size=100m
+bs=64k
+startdelay=0
+ioengine=sync
+numjobs=8
diff --git a/glustolibs-io/shared_files/tools/fio/large_files_fio_job.ini b/glustolibs-io/shared_files/tools/fio/large_files_fio_job.ini
new file mode 100644
index 0000000..aaf68b1
--- /dev/null
+++ b/glustolibs-io/shared_files/tools/fio/large_files_fio_job.ini
@@ -0,0 +1,9 @@
+#Sample large file fio job file for generating IO's of filesize 2g
+[global]
+rw=write
+fsync_on_close=1
+size=2g
+bs=64k
+startdelay=0
+ioengine=sync
+numjobs=8
diff --git a/glustolibs-io/shared_files/tools/fio/run_fio.py b/glustolibs-io/shared_files/tools/fio/run_fio.py
new file mode 100644
index 0000000..ea20175
--- /dev/null
+++ b/glustolibs-io/shared_files/tools/fio/run_fio.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+# Copyright (C) 2015-2016 Red Hat, Inc. <http://www.redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import os
+import argparse
+import fileinput
+import re
+import subprocess
+import time
+
+
+def generate_workload_using_fio(root_dirname, ini_file):
+ """
+ Populates data in the given directory using fio tool.
+
+ Args:
+ root_dirname (str): Directory name
+ ini_file (str): fio job file
+
+ Example:
+ generate_workload_using_fio("/tmp", 'job1.ini')
+
+ """
+ dirpath_list = [x[0] for x in (os.walk(root_dirname))]
+
+ for dirpath in dirpath_list:
+ fname = "[" + dirpath + "/fio_" + os.path.basename(ini_file) + "]"
+ for line in fileinput.input(ini_file, inplace=True):
+ line = re.sub(r'\[.*\]', fname, line.rstrip())
+ print(line)
+
+ fio_cmd = "fio " + ini_file
+ subprocess.call(fio_cmd, shell=True)
+
+
+if __name__ == "__main__":
+
+ # Note: Make sure fio tool is installed in the node
+ # Please refer below link for installing fio.
+ # http://git.kernel.dk/?p=fio.git;a=blob;f=README;
+ # h=5fa37f3eed33a15a15a38836cf0080edc81688fd;hb=HEAD
+
+ parser = argparse.ArgumentParser(prog="test_fio.py",
+ description=("Generate workload "
+ "using fio"))
+ parser.add_argument(
+ 'dir', metavar='DIR', type=str,
+ help="Directory on which IO has to be performed")
+ parser.add_argument('--job-files',
+ metavar=('job_files'), dest='job_files',
+ help="space separated absolute paths of "
+ "ini job files", required=True)
+ args = parser.parse_args()
+ root_dirname = args.dir
+ ini_files_list = args.job_files.split()
+
+ for ini_file in ini_files_list:
+ generate_workload_using_fio(root_dirname, ini_file)
+ time.sleep(2)
diff --git a/glustolibs-io/shared_files/tools/fio/small_files_fio_job.ini b/glustolibs-io/shared_files/tools/fio/small_files_fio_job.ini
new file mode 100644
index 0000000..ef4d67c
--- /dev/null
+++ b/glustolibs-io/shared_files/tools/fio/small_files_fio_job.ini
@@ -0,0 +1,8 @@
+#Sample small files fio job file for generating IO's of filesize 128k
+[global]
+rw=write
+fsync_on_close=1
+size=128k
+startdelay=0
+ioengine=sync
+numjobs=8