X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsrc%2Frbd-replay-many;fp=src%2Fceph%2Fsrc%2Frbd-replay-many;h=e89e9ab90a7c22dfe6992707622a6512a3419445;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/src/rbd-replay-many b/src/ceph/src/rbd-replay-many new file mode 100755 index 0000000..e89e9ab --- /dev/null +++ b/src/ceph/src/rbd-replay-many @@ -0,0 +1,88 @@ +#!/bin/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