koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 1 | #!/bin/bash |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 2 | set -e |
| 3 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 4 | # don't forget to change it in prepare.sh as well |
| 5 | my_dir="$(dirname "$0")" |
| 6 | source "$my_dir/config.sh" |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 7 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 8 | BLOCK_SIZES="1k 4k 64k 256k 1m" |
| 9 | OPERATIONS="randwrite write randread read" |
| 10 | SYNC_TYPES="s a d" |
| 11 | REPEAT_COUNT="3" |
| 12 | CONCURRENCES="1 8 64" |
| 13 | IODEPTHS="16" |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 14 | |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 15 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 16 | SYNC_FACTOR="x500" |
| 17 | DIRECT_FACTOR="x500" |
| 18 | ASYNC_FACTOR="r2" |
koder aka kdanilov | 3f35626 | 2015-02-13 08:06:14 -0800 | [diff] [blame] | 19 | |
koder aka kdanilov | e21d747 | 2015-02-14 19:02:04 -0800 | [diff] [blame] | 20 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 21 | function get_file_size_opts() { |
| 22 | SYNC_TYPE="$1" |
| 23 | if [ "$SYNC_TYPE" = "s" ] ; then |
| 24 | echo "--iosize $SYNC_FACTOR -s" |
| 25 | elif [ "$SYNC_TYPE" = "d" ] ; then |
| 26 | echo "--iosize $DIRECT_FACTOR -d" |
| 27 | else |
| 28 | echo "--iosize $ASYNC_FACTOR" |
| 29 | fi |
| 30 | } |
koder aka kdanilov | 3f35626 | 2015-02-13 08:06:14 -0800 | [diff] [blame] | 31 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 32 | function echo_combinations() { |
| 33 | for IODEPTH in $IODEPTHS ; do |
| 34 | for CONCURRENCE in $CONCURRENCES ; do |
| 35 | for BSIZE in $BLOCK_SIZES ; do |
| 36 | for OPERATION in $OPERATIONS ; do |
| 37 | for SYNC_TYPE in $SYNC_TYPES ; do |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 38 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 39 | # filter out too slow options |
koder aka kdanilov | 7dec9df | 2015-02-15 21:35:19 -0800 | [diff] [blame] | 40 | if [ "$BSIZE" = "1k" -o "$BSIZE" = "4k" ] ; then |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 41 | if [ "$SYNC_TYPE" = "a" ] ; then |
| 42 | continue |
| 43 | fi |
| 44 | fi |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 45 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 46 | # filter out sync reads |
| 47 | if [ "$OPERATION" = "read" -o "$OPERATION" = "randread" ] ; then |
| 48 | if [ "$SYNC_TYPE" = "s" ] ; then |
| 49 | continue |
| 50 | fi |
| 51 | fi |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 52 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 53 | FILE_SIZE_AND_SYNC=$(get_file_size_opts "$SYNC_TYPE") |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 54 | |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 55 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 56 | IO_OPTS="--type $TESTER_TYPE " |
| 57 | IO_OPTS="$IO_OPTS -a $OPERATION " |
| 58 | IO_OPTS="$IO_OPTS --iodepth $IODEPTH " |
| 59 | IO_OPTS="$IO_OPTS --blocksize $BSIZE " |
| 60 | IO_OPTS="$IO_OPTS $FILE_SIZE_AND_SYNC " |
| 61 | IO_OPTS="$IO_OPTS --concurrency $CONCURRENCE" |
koder aka kdanilov | 4a72f12 | 2015-02-09 12:25:54 +0200 | [diff] [blame] | 62 | |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 63 | for COUNTER in $(seq 1 $REPEAT_COUNT) ; do |
| 64 | echo $IO_OPTS |
| 65 | done |
| 66 | done |
| 67 | done |
| 68 | done |
| 69 | done |
| 70 | done |
| 71 | } |
| 72 | |
| 73 | |
| 74 | function run_test() { |
| 75 | OPTION_FILE="$1" |
| 76 | |
| 77 | if [ ! -f "$OPTION_FILE" ] ; then |
| 78 | echo "Path to file with io.py options list should be passed" |
| 79 | exit 1 |
| 80 | fi |
| 81 | |
| 82 | if [ "$RUNNER" = "ssh" ] ; then |
| 83 | GROUP_ID=$(nova server-group-list | grep " $SERV_GROUP " | awk '{print $2}' ) |
| 84 | EXTRA_OPTS="user=$IMAGE_USER" |
| 85 | EXTRA_OPTS="${EXTRA_OPTS},keypair_name=$KEYPAIR_NAME" |
| 86 | EXTRA_OPTS="${EXTRA_OPTS},img_name=$IMAGE_NAME" |
| 87 | EXTRA_OPTS="${EXTRA_OPTS},flavor_name=$FLAVOR_NAME" |
| 88 | EXTRA_OPTS="${EXTRA_OPTS},network_zone_name=$NETWORK_ZONE_NAME" |
| 89 | EXTRA_OPTS="${EXTRA_OPTS},flt_ip_pool=$FL_NETWORK_ZONE_NAME" |
| 90 | EXTRA_OPTS="${EXTRA_OPTS},key_file=$KEY_FILE_NAME" |
| 91 | EXTRA_OPTS="${EXTRA_OPTS},aff_group=$GROUP_ID" |
| 92 | EXTRA_OPTS="${EXTRA_OPTS},count=$VM_COUNT" |
| 93 | else |
| 94 | echo "Unsupported runner $RUNNER" |
| 95 | exit 1 |
| 96 | fi |
| 97 | |
koder aka kdanilov | 6e2ae79 | 2015-03-04 18:02:24 -0800 | [diff] [blame] | 98 | RUN_TEST_OPTS="-t io -l --runner $RUNNER" |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 99 | set -x |
koder aka kdanilov | 6e2ae79 | 2015-03-04 18:02:24 -0800 | [diff] [blame] | 100 | python run_test.py $RUN_TEST_OPTS --create-vms-opts="$EXTRA_OPTS" -f "$OPTION_FILE" $TESTER_TYPE |
koder aka kdanilov | 83cd713 | 2015-02-14 21:37:14 -0800 | [diff] [blame] | 101 | set +x |
| 102 | } |
| 103 | |
| 104 | if [ "$1" = '--prepare-opts' ] ; then |
| 105 | echo_combinations |
| 106 | else |
| 107 | run_test $1 |
| 108 | fi |
| 109 | |