summaryrefslogtreecommitdiffstats
path: root/src/rbd-replay-many
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/rbd-replay-many
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/rbd-replay-many')
-rwxr-xr-xsrc/rbd-replay-many88
1 files changed, 88 insertions, 0 deletions
diff --git a/src/rbd-replay-many b/src/rbd-replay-many
new file mode 100755
index 000000000..eacaea9ab
--- /dev/null
+++ b/src/rbd-replay-many
@@ -0,0 +1,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