From e6918187568dbd01842d8d1d2c808ce16a894239 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 21 Apr 2024 13:54:28 +0200 Subject: Adding upstream version 18.2.2. Signed-off-by: Daniel Baumann --- src/rbd-replay-many | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100755 src/rbd-replay-many (limited to 'src/rbd-replay-many') 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= [ [...]] -- " + 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 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 -- cgit v1.2.3