Add options to select different test szenarios

Added:
- test for read-write
- make iointerface selectable
This commit is contained in:
Thomas Gebert 2024-12-09 14:11:15 +01:00
parent c115a9e38e
commit 64256add50

View File

@ -11,6 +11,14 @@ import sys
################################################################################ ################################################################################
# Global variables and defaults # Global variables and defaults
################################################################################ ################################################################################
iointerfaces_allowed = [
'async',
'cached',
'direct',
'sync',
'dsync'
]
ioping_arguments = { ioping_arguments = {
'location': '', 'location': '',
'cmd': 'ioping --batch', 'cmd': 'ioping --batch',
@ -94,15 +102,19 @@ def get_parser():
parser.add_argument('-i', '--interval', parser.add_argument('-i', '--interval',
help = 'interval between requests', help = 'interval between requests',
default = '1s') default = '1s')
parser.add_argument('--iointerface',
help = 'Which ionterface to use: async|cached|direct|sync|dsync',
default = '')
parser.add_argument('-l', '--location', parser.add_argument('-l', '--location',
help = 'directory|file|device to test. Best would be a directory to not shred anything accidentially', help = 'directory|file|device to test. Best would be a directory to not shred anything accidentially',
default = '/tmp') default = '/tmp')
parser.add_argument('-m', '--mode', parser.add_argument('-m', '--mode',
help = 'Which output mode to use: shell|telegraf', help = 'Which output to use: shell|telegraf',
default = 'telegraf') default = 'telegraf')
parser.add_argument('-o', '--options', parser.add_argument('-w', '--read-write',
help = 'Arbitary options from the ioping options, like -read-write', help = 'Use read-write test instead of read.',
default = '') action = 'store_true',
default = 'False')
return parser return parser
@ -114,7 +126,12 @@ def main():
ioping_arguments['location'] = args.location ioping_arguments['location'] = args.location
ioping_arguments['count'] = args.count ioping_arguments['count'] = args.count
ioping_arguments['interval'] = args.interval ioping_arguments['interval'] = args.interval
ioping_arguments['options'] = args.options if args.read_write == True:
ioping_arguments['options'] += '--read-write '
if not args.iointerface == '':
if args.iointerface in iointerfaces_allowed:
ioping_arguments['options'] += '--%s ' % args.iointerface
if args.mode == 'shell': if args.mode == 'shell':
returncode = ioping_output_shell() returncode = ioping_output_shell()
@ -131,4 +148,3 @@ def main():
################################################################################ ################################################################################
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())