summaryrefslogtreecommitdiffstats
path: root/glustolibs-io
diff options
context:
space:
mode:
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 000000000..27c930a3a
--- /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 000000000..63b9754bb
--- /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 000000000..aaf68b1df
--- /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 000000000..ea20175cb
--- /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 000000000..ef4d67cdb
--- /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