blob: f7c14ad2f879a0def6c3c0342bd57f38f48b1527 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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 = "100%"
self.filename = '/dev/vdb'
self.options = {
'ioengine': 'libaio',
'direct': '1',
'rw': 'read',
'bs': '64k',
'iodepth': '1',
'numjobs': '1',
'loops': '2',
'output-format': 'json',
'status-interval': '600'
}
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
|