| 1 |
|
| 2 |
#!/bin/bash |
| 3 |
# Copyright 2010-2012 Thomas Schoebel-Theuer / 1&1 Internet AG |
| 4 |
# |
| 5 |
# Copying and distribution of this file, with or without modification, |
| 6 |
# are permitted in any medium without royalty provided the copyright |
| 7 |
# notice and this notice are preserved. This file is offered as-is, |
| 8 |
# without any warranty. |
| 9 |
|
| 10 |
##################################################################### |
| 11 |
|
| 12 |
## defaults for module create_lv |
| 13 |
## |
| 14 |
## create_lv: before filling all devices with random data, (re)create your LVs |
| 15 |
## |
| 16 |
## ATTENTION! Always use this module when running benchmarks on |
| 17 |
## virtualized storage! |
| 18 |
## |
| 19 |
## Read the section about "Pitfalls from Storage Virtualization" |
| 20 |
## in https://github.com/schoebel/blkreplay/raw/master/doc/blkreplay.pdf |
| 21 |
## |
| 22 |
## You *MUST* delete and re-create your LVs at every run on commercial |
| 23 |
## storage boxes as well as other virtualized storage! |
| 24 |
|
| 25 |
## enable_create_lv |
| 26 |
## |
| 27 |
## Set to 0 or 1. Enable / disable this module. |
| 28 |
|
| 29 |
enable_create_lv=0 |
| 30 |
|
| 31 |
# implement the next function such that it can be called twice |
| 32 |
# (even when no LVs exist any more) without causing errors. |
| 33 |
# |
| 34 |
# However, in case of errors just "return 1" to signal it! |
| 35 |
|
| 36 |
function delete_lv |
| 37 |
{ |
| 38 |
echo "$FUNCNAME deleting all your LVs" |
| 39 |
# ensure that nothing can go wrong any more... |
| 40 |
replay_host_list="" |
| 41 |
|
| 42 |
# put in your code here |
| 43 |
# ... |
| 44 |
|
| 45 |
if (( failure )); then |
| 46 |
echo "Sorry. Some devices are left over. Remove them by hand!" |
| 47 |
return 1 |
| 48 |
fi |
| 49 |
|
| 50 |
# success |
| 51 |
return 0 |
| 52 |
} |
| 53 |
|
| 54 |
# this should also signal success by the return code. |
| 55 |
|
| 56 |
function create_lv |
| 57 |
{ |
| 58 |
echo "$FUNCNAME creating all your LVs" |
| 59 |
|
| 60 |
# put in your code here |
| 61 |
# ... |
| 62 |
|
| 63 |
if (( failure )); then |
| 64 |
echo "Sorry. Setup failed." |
| 65 |
return 1 |
| 66 |
fi |
| 67 |
|
| 68 |
# upon success: tell which devices can be used. |
| 69 |
replay_host_list="yourhost1:/dev/device1 yourhost2:/dev/device2" |
| 70 |
echo "replay_host_list='$replay_host_list'" |
| 71 |
return 0 |
| 72 |
} |