]> git.proxmox.com Git - ceph.git/blame - ceph/src/rbd-replay-many
update sources to 12.2.2
[ceph.git] / ceph / src / rbd-replay-many
CommitLineData
7c673cae
FG
1#!/bin/bash
2
3original_image=
4hosts=
5image_prefix=
6prog=rbd-replay
7delay=0
8
9while test -n "$1"; do
10 case "$1" in
11 --original-image)
12 original_image="$2"
13 shift
14 ;;
15 --original-image=*)
16 original_image="${1#--original-image=}"
17 ;;
18 --image-prefix)
19 image_prefix="$2"
20 shift
21 ;;
22 --image-prefix=*)
23 image_prefix="${1#--image-prefix=}"
24 ;;
25 --exec)
26 prog="$2"
27 shift
28 ;;
29 --exec=*)
30 prog="${1#--exec=}"
31 ;;
32 --delay)
33 delay="$2"
34 shift
35 ;;
36 --delay=*)
37 delay="${1#--delay=}"
38 ;;
39 --help|-h)
40 echo "Usage: $0 [options] --original-image=<name> <host1> [<host2> [...]] -- <rbd-replay-args>"
41 echo "Options:"
42 echo " --original-image=name Name (and snap) of the image that was originally traced"
43 echo " --image-prefix=prefix Prefix of the image names to replay against"
44 echo " --exec=program Path to the rbd-replay executable"
45 echo " --delay=seconds Wait <seconds> between starting each replay"
46 exit 0
47 ;;
48 --)
49 # remaining args are passed directly to rbd-replay
50 shift
51 break
52 ;;
53 -*)
54 echo "Unrecognized argument: $1" >&2
55 echo "(If you want to pass an argument directly to rbd-replay, use it after '--'.)" >&2
56 exit 1
57 ;;
58 *)
59 hosts="$hosts $1"
60 ;;
61 esac
62 shift
63done
64
65if test -z "$original_image"; then
66 echo "Specify the original image name with --original-image." >&2
67 exit 1
68fi
69
70if test -z "$hosts"; then
71 echo "No hosts specified." >&2
72 exit 1
73fi
74
75if test -z "$image_prefix"; then
76 image_prefix="$original_image"
77fi
78
79index=0
80for host in $hosts; do
81 echo ssh $host "'$prog'" --map-image "'${original_image}=${image_prefix}-${index}'" "$@"
82 ssh $host "'$prog'" --map-image "'${original_image}=${image_prefix}-${index}'" "$@" &
83 index=$((index + 1))
84 if [ $delay -gt 0 ]; then
85 sleep $delay
86 fi
87done
88wait