summaryrefslogtreecommitdiffstats
path: root/storperf/workloads/_base_workload.py
diff options
context:
space:
mode:
authormbeierl <mark.beierl@emc.com>2015-11-23 08:23:47 -0800
committermbeierl <mark.beierl@emc.com>2015-11-23 20:15:59 -0800
commit002920e29d7fa4a28abec96773b470c90bafe55d (patch)
tree893f45209a84f197ef6ec3848ed83fc9df3eab8f /storperf/workloads/_base_workload.py
parentd480e8746512caf8821c42582e7ab75d25b3127b (diff)
Adding workload modules
Adding the ablity to define workloads in modules which can be referenced from the API. Breaking out the test execution into its own class so it will be easier to support ReST or other interfaces. Added flake8 and code coverage reports where possible to merge and verify jobs Change-Id: Ieb51e4e7e1e989288a6f81f4757709669914a196 JIRA: STORPERF-21 Signed-off-by: mbeierl <mark.beierl@emc.com>
Diffstat (limited to 'storperf/workloads/_base_workload.py')
-rw-r--r--storperf/workloads/_base_workload.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/storperf/workloads/_base_workload.py b/storperf/workloads/_base_workload.py
new file mode 100644
index 0000000..7e13e45
--- /dev/null
+++ b/storperf/workloads/_base_workload.py
@@ -0,0 +1,54 @@
+##############################################################################
+# Copyright (c) 2015 EMC and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import logging
+
+
+class _base_workload(object):
+
+ def __init__(self):
+ self.logger = logging.getLogger(__name__)
+ self.default_filesize = "128M"
+ self.filename = 'storperf.dat'
+ self.options = {
+ 'ioengine': 'libaio',
+ 'direct': '1',
+ 'rw': 'read',
+ 'bs': '4k',
+ 'iodepth': '1',
+ 'numjobs': '1',
+ 'loops': '2',
+ 'output-format': 'json',
+ 'status-interval': '60'
+ }
+ self.invoker = None
+
+ def execute(self):
+ args = []
+
+ if self.filename.startswith("/dev"):
+ self.options['size'] = "100%"
+ self.logger.debug(
+ "Profiling a device, using 100% of " + self.filename)
+ else:
+ self.options['size'] = self.default_filesize
+ self.logger.debug("Profiling a filesystem, using " +
+ self.default_filesize + " file")
+
+ self.options['filename'] = self.filename
+
+ self.setup()
+
+ for key, value in self.options.iteritems():
+ args.append('--' + key + "=" + value)
+
+ self.invoker.execute(args)
+
+ def setup(self):
+ pass