blob: eacaea9ab625bc595dcd2865ffc8d38a59dcbd21 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/usr/bin/env bash
original_image=
hosts=
image_prefix=
prog=rbd-replay
delay=0
while test -n "$1"; do
case "$1" in
--original-image)
original_image="$2"
shift
;;
--original-image=*)
original_image="${1#--original-image=}"
;;
--image-prefix)
image_prefix="$2"
shift
;;
--image-prefix=*)
image_prefix="${1#--image-prefix=}"
;;
--exec)
prog="$2"
shift
;;
--exec=*)
prog="${1#--exec=}"
;;
--delay)
delay="$2"
shift
;;
--delay=*)
delay="${1#--delay=}"
;;
--help|-h)
echo "Usage: $0 [options] --original-image=<name> <host1> [<host2> [...]] -- <rbd-replay-args>"
echo "Options:"
echo " --original-image=name Name (and snap) of the image that was originally traced"
echo " --image-prefix=prefix Prefix of the image names to replay against"
echo " --exec=program Path to the rbd-replay executable"
echo " --delay=seconds Wait <seconds> between starting each replay"
exit 0
;;
--)
# remaining args are passed directly to rbd-replay
shift
break
;;
-*)
echo "Unrecognized argument: $1" >&2
echo "(If you want to pass an argument directly to rbd-replay, use it after '--'.)" >&2
exit 1
;;
*)
hosts="$hosts $1"
;;
esac
shift
done
if test -z "$original_image"; then
echo "Specify the original image name with --original-image." >&2
exit 1
fi
if test -z "$hosts"; then
echo "No hosts specified." >&2
exit 1
fi
if test -z "$image_prefix"; then
image_prefix="$original_image"
fi
index=0
for host in $hosts; do
echo ssh $host "'$prog'" --map-image "'${original_image}=${image_prefix}-${index}'" "$@"
ssh $host "'$prog'" --map-image "'${original_image}=${image_prefix}-${index}'" "$@" &
index=$((index + 1))
if [ $delay -gt 0 ]; then
sleep $delay
fi
done
wait
|